lowdefy/packages/docs/operators/_diff.yaml

76 lines
2.1 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/operators.yaml.njk
transformer: templates/operatorsMethodTransformer.js
vars:
pageId: _diff
pageTitle: _diff
filePath: operators/_diff.yaml
methods:
- name: deep
types: |
```
(arguments: {lhs: any, rhs: any}): object[]
([lhs: any, rhs: any]): object[]
```
description: |
The `_diff.deep` method compares two objects and returns an object that describes the structural differences between the two objects.
arguments: |
###### string
The string to decode.
examples: |
###### Compare two objects using named args:
```yaml
_diff.deep:
lhs:
deleted: To be deleted
edited: Edit me
array: [1]
rhs:
new: New value
edited: Edited
array: [1, 2]
```
```yaml
_diff.deep:
- deleted: To be deleted
edited: Edit me
array: [1]
- new: New value
edited: Edited
array: [1, 2]
```
Both return:
```yaml
- kind: D
path: [deleted]
lhs: To be deleted
- kind: E
path: [edited]
lhs: Edit me
rhs: Edited
- kind: A
path: ['array']
index: 1
item:
kind: N
rhs: 2
- kind: N
path: [new]
rhs: New value
```