@lowdefy/docs 4.0.0-alpha.29 → 4.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
function custom_filter_default_value({ params }) {
|
|
17
|
+
const { value: value1 , defaultValue } = params;
|
|
18
|
+
const isEmptyObject = (obj)=>type.isObject(obj) && Object.keys(obj).length === 0;
|
|
19
|
+
const getNestedValue = (obj, path)=>{
|
|
20
|
+
const keys = [
|
|
21
|
+
...path
|
|
22
|
+
];
|
|
23
|
+
const key = keys.shift();
|
|
24
|
+
const value = obj[key];
|
|
25
|
+
if (keys.length > 0 && type.isObject(value)) return getNestedValue(value, keys);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
const filterObject = ({ obj , path })=>{
|
|
29
|
+
Object.keys(obj).forEach((key)=>{
|
|
30
|
+
const propPath = path.concat([
|
|
31
|
+
key
|
|
32
|
+
]);
|
|
33
|
+
if (type.isObject(obj[key])) {
|
|
34
|
+
filterObject({
|
|
35
|
+
obj: obj[key],
|
|
36
|
+
path: propPath
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const dv = getNestedValue(defaultValue, propPath);
|
|
40
|
+
if (obj[key] === dv) {
|
|
41
|
+
delete obj[key];
|
|
42
|
+
}
|
|
43
|
+
if (obj[key] === null || isEmptyObject(obj[key])) {
|
|
44
|
+
delete obj[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return obj;
|
|
48
|
+
};
|
|
49
|
+
return filterObject({
|
|
50
|
+
obj: value1,
|
|
51
|
+
path: []
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export default custom_filter_default_value;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export { default as _custom_filter_default_value } from './operators/client/filter_default_value.js';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import * as operatorsClient from './operatorsClient.js';
|
|
16
|
+
export default {
|
|
17
|
+
operators: {
|
|
18
|
+
client: Object.keys(operatorsClient)
|
|
19
|
+
}
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/docs",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.30",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
45
|
+
"@lowdefy/helpers": "4.0.0-alpha.30"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@jest/globals": "28.1.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "c30cc4e28e221d9b73385cca8d339397d60da0e1"
|
|
58
58
|
}
|