@lowdefy/operators 3.23.2 → 4.0.0-alpha.6

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.
Files changed (71) hide show
  1. package/dist/getFromArray.js +22 -44
  2. package/dist/getFromObject.js +25 -70
  3. package/dist/index.js +18 -20
  4. package/dist/nodeParser.js +83 -146
  5. package/dist/runClass.js +57 -82
  6. package/dist/runInstance.js +60 -84
  7. package/dist/webParser.js +94 -157
  8. package/package.json +13 -19
  9. package/dist/common/_index.js +0 -45
  10. package/dist/common/and.js +0 -39
  11. package/dist/common/args.js +0 -46
  12. package/dist/common/array.js +0 -170
  13. package/dist/common/change_case.js +0 -185
  14. package/dist/common/date.js +0 -75
  15. package/dist/common/divide.js +0 -51
  16. package/dist/common/eq.js +0 -43
  17. package/dist/common/event.js +0 -46
  18. package/dist/common/function.js +0 -78
  19. package/dist/common/get.js +0 -61
  20. package/dist/common/global.js +0 -50
  21. package/dist/common/gt.js +0 -43
  22. package/dist/common/gte.js +0 -43
  23. package/dist/common/if.js +0 -41
  24. package/dist/common/if_none.js +0 -47
  25. package/dist/common/index.js +0 -69
  26. package/dist/common/input.js +0 -50
  27. package/dist/common/json.js +0 -64
  28. package/dist/common/log.js +0 -33
  29. package/dist/common/lt.js +0 -43
  30. package/dist/common/lte.js +0 -43
  31. package/dist/common/math.js +0 -210
  32. package/dist/common/mql.js +0 -124
  33. package/dist/common/ne.js +0 -43
  34. package/dist/common/not.js +0 -31
  35. package/dist/common/number.js +0 -125
  36. package/dist/common/nunjucks.js +0 -60
  37. package/dist/common/object.js +0 -118
  38. package/dist/common/operator.js +0 -49
  39. package/dist/common/or.js +0 -39
  40. package/dist/common/product.js +0 -45
  41. package/dist/common/random.js +0 -132
  42. package/dist/common/regex.js +0 -65
  43. package/dist/common/state.js +0 -50
  44. package/dist/common/string.js +0 -188
  45. package/dist/common/subtract.js +0 -47
  46. package/dist/common/sum.js +0 -45
  47. package/dist/common/switch.js +0 -49
  48. package/dist/common/type.js +0 -82
  49. package/dist/common/uri.js +0 -67
  50. package/dist/common/url_query.js +0 -50
  51. package/dist/common/user.js +0 -50
  52. package/dist/common/uuid.js +0 -76
  53. package/dist/common/yaml.js +0 -70
  54. package/dist/getFromOtherContext.js +0 -96
  55. package/dist/node/base64.js +0 -69
  56. package/dist/node/diff.js +0 -66
  57. package/dist/node/hash.js +0 -100
  58. package/dist/node/index.js +0 -29
  59. package/dist/node/secret.js +0 -54
  60. package/dist/web/actions.js +0 -46
  61. package/dist/web/base64.js +0 -67
  62. package/dist/web/event_log.js +0 -50
  63. package/dist/web/format.js +0 -52
  64. package/dist/web/index.js +0 -36
  65. package/dist/web/js.js +0 -45
  66. package/dist/web/list_contexts.js +0 -31
  67. package/dist/web/location.js +0 -74
  68. package/dist/web/media.js +0 -90
  69. package/dist/web/menu.js +0 -43
  70. package/dist/web/request.js +0 -56
  71. package/dist/web/request_details.js +0 -50
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
11
-
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13
-
14
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
-
16
- function _operator(options) {
17
- var {
18
- operations,
19
- params,
20
- location
21
- } = options;
22
-
23
- if (!_helpers.type.isString(params.name)) {
24
- throw new Error("Operator Error: _operator.name must be a valid operator name as string. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
25
- }
26
-
27
- if (params.name === '_operator') {
28
- throw new Error("Operator Error: _operator.name cannot be set to _operator to infinite avoid loop reference. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
29
- }
30
-
31
- if (params.name.includes('experimental')) {
32
- throw new Error("Operator Error: Experimental operators cannot be used with _operator. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- var [operator, methodName] = params.name.split('.');
36
-
37
- if (Object.prototype.hasOwnProperty.call(operations, operator)) {
38
- return operations[operator](_objectSpread(_objectSpread({}, options), {}, {
39
- location,
40
- params: params && params.params,
41
- methodName
42
- }));
43
- }
44
-
45
- throw new Error("Operator Error: _operator - Invalid operator name. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
46
- }
47
-
48
- var _default = _operator;
49
- exports.default = _default;
package/dist/common/or.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _or(_ref) {
26
- var {
27
- location,
28
- params
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _or takes an array type. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- return !!params.reduce((acc, el) => acc || el, false);
36
- }
37
-
38
- var _default = _or;
39
- exports.default = _default;
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _product(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _product takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- return params.reduce((accumulator, value) => {
36
- if (_helpers.type.isNumber(value)) {
37
- return accumulator * value;
38
- }
39
-
40
- return accumulator;
41
- }, 1);
42
- }
43
-
44
- var _default = _product;
45
- exports.default = _default;
@@ -1,132 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- var typesEnum = ['string', 'integer', 'float'];
26
-
27
- function generateRandomString(length) {
28
- var randomString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
29
- randomString += Math.random().toString(36).substr(2, length);
30
- if (randomString.length > length) return randomString.slice(0, length);
31
- return generateRandomString(length, randomString);
32
- } // Both minimum and maximum is inclusive.
33
-
34
-
35
- function getRandomInt(min, max) {
36
- return Math.floor(Math.random() * (Math.ceil(max) - Math.floor(min)) + Math.floor(min));
37
- }
38
-
39
- function getRandomFloat(min, max) {
40
- return Math.random() * (Math.ceil(max) - Math.floor(min)) + Math.floor(min);
41
- }
42
-
43
- function evaluateDefaultNumber(_ref) {
44
- var {
45
- key,
46
- defaultValue,
47
- params,
48
- location
49
- } = _ref;
50
-
51
- if (_helpers.type.isUndefined(params[key])) {
52
- params[key] = defaultValue;
53
- }
54
-
55
- if (!_helpers.type.isNumber(params[key])) {
56
- throw new Error("Operator Error: _random.".concat(key, " takes an number type. Received: ").concat(JSON.stringify(params), " at ").concat(location, "."));
57
- }
58
- }
59
-
60
- function _random(_ref2) {
61
- var {
62
- location,
63
- params
64
- } = _ref2;
65
-
66
- if (!_helpers.type.isString(params) && !_helpers.type.isObject(params)) {
67
- throw new Error("Operator Error: _random takes an string or object type. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
68
- }
69
-
70
- if (!_helpers.type.isObject(params)) {
71
- params = {
72
- type: params
73
- };
74
- }
75
-
76
- if (!typesEnum.includes(params.type)) {
77
- throw new Error("Operator Error: _random type can be either 'string', 'integer' or 'float'. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
78
- }
79
-
80
- if (params.type === 'float') {
81
- evaluateDefaultNumber({
82
- key: 'min',
83
- defaultValue: 0,
84
- params,
85
- location
86
- });
87
- evaluateDefaultNumber({
88
- key: 'max',
89
- defaultValue: params.min + 1,
90
- params,
91
- location
92
- });
93
-
94
- if (params.max < params.min) {
95
- throw new Error("Operator Error: _random.min must be less than _random.max. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
96
- }
97
-
98
- return getRandomFloat(params.min, params.max);
99
- }
100
-
101
- if (params.type === 'integer') {
102
- evaluateDefaultNumber({
103
- key: 'min',
104
- defaultValue: 0,
105
- params,
106
- location
107
- });
108
- evaluateDefaultNumber({
109
- key: 'max',
110
- defaultValue: params.min + 100,
111
- params,
112
- location
113
- });
114
-
115
- if (params.max < params.min) {
116
- throw new Error("Operator Error: _random.min must be less than _random.max. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
117
- }
118
-
119
- return getRandomInt(params.min, params.max);
120
- }
121
-
122
- evaluateDefaultNumber({
123
- key: 'length',
124
- defaultValue: 8,
125
- params,
126
- location
127
- });
128
- return generateRandomString(params.length);
129
- }
130
-
131
- var _default = _random;
132
- exports.default = _default;
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _regex(_ref) {
26
- var {
27
- location,
28
- params,
29
- state
30
- } = _ref;
31
- var pattern = _helpers.type.isObject(params) ? params.pattern : params;
32
-
33
- if (!_helpers.type.isString(pattern)) {
34
- throw new Error("Operator Error: _regex.pattern must be a string. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
35
- }
36
-
37
- var on = !_helpers.type.isUndefined(params.on) ? params.on : (0, _helpers.get)(state, location);
38
-
39
- if (!_helpers.type.isUndefined(params.key)) {
40
- if (!_helpers.type.isString(params.key)) {
41
- throw new Error("Operator Error: _regex.key must be a string. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
42
- }
43
-
44
- on = (0, _helpers.get)(state, params.key);
45
- }
46
-
47
- if (_helpers.type.isNone(on)) {
48
- return false;
49
- }
50
-
51
- if (!_helpers.type.isString(on)) {
52
- throw new Error("Operator Error: _regex.on must be a string. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
53
- }
54
-
55
- try {
56
- var re = new RegExp(pattern, params.flags || 'gm');
57
- return re.test(on);
58
- } catch (e) {
59
- // log e to LowdefyError
60
- throw new Error("Operator Error: _regex failed to execute RegExp.test. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
61
- }
62
- }
63
-
64
- var _default = _regex;
65
- exports.default = _default;
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _getFromObject = _interopRequireDefault(require("../getFromObject"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /*
13
- Copyright 2020-2021 Lowdefy, Inc
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License");
16
- you may not use this file except in compliance with the License.
17
- You may obtain a copy of the License at
18
-
19
- http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- Unless required by applicable law or agreed to in writing, software
22
- distributed under the License is distributed on an "AS IS" BASIS,
23
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- See the License for the specific language governing permissions and
25
- limitations under the License.
26
- */
27
- function _state(_ref) {
28
- var {
29
- arrayIndices,
30
- context,
31
- contexts,
32
- env,
33
- location,
34
- params,
35
- state
36
- } = _ref;
37
- return (0, _getFromObject.default)({
38
- arrayIndices,
39
- context,
40
- contexts,
41
- env,
42
- location,
43
- object: state,
44
- operator: '_state',
45
- params
46
- });
47
- }
48
-
49
- var _default = _state;
50
- exports.default = _default;
@@ -1,188 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _runInstance = _interopRequireDefault(require("../runInstance"));
9
-
10
- var _helpers = require("@lowdefy/helpers");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- /*
15
- Copyright 2020-2021 Lowdefy, Inc
16
-
17
- Licensed under the Apache License, Version 2.0 (the "License");
18
- you may not use this file except in compliance with the License.
19
- You may obtain a copy of the License at
20
-
21
- http://www.apache.org/licenses/LICENSE-2.0
22
-
23
- Unless required by applicable law or agreed to in writing, software
24
- distributed under the License is distributed on an "AS IS" BASIS,
25
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- See the License for the specific language governing permissions and
27
- limitations under the License.
28
- */
29
- var prepRegex = (regexIndex, flagsIndex) => args => {
30
- if (args[regexIndex]) {
31
- args[regexIndex] = new RegExp(args[regexIndex], args[flagsIndex]);
32
- }
33
-
34
- if (_helpers.type.isNone(args[0])) {
35
- args[0] = '';
36
- }
37
-
38
- return args;
39
- };
40
-
41
- var prep = args => {
42
- if (_helpers.type.isNone(args[0])) {
43
- args[0] = '';
44
- }
45
-
46
- return args;
47
- };
48
-
49
- var meta = {
50
- charAt: {
51
- namedArgs: ['on', 'index'],
52
- prep,
53
- validTypes: ['array', 'object']
54
- },
55
- // 'charCodeAt',
56
- concat: {
57
- prep,
58
- validTypes: ['array']
59
- },
60
- endsWith: {
61
- namedArgs: ['on', 'searchString', 'length'],
62
- prep,
63
- validTypes: ['array', 'object']
64
- },
65
- includes: {
66
- namedArgs: ['on', 'searchString', 'position'],
67
- prep,
68
- validTypes: ['array', 'object']
69
- },
70
- indexOf: {
71
- namedArgs: ['on', 'searchValue', 'fromIndex'],
72
- prep,
73
- validTypes: ['array', 'object']
74
- },
75
- lastIndexOf: {
76
- namedArgs: ['on', 'searchValue', 'fromIndex'],
77
- prep,
78
- validTypes: ['array', 'object']
79
- },
80
- // 'localeCompare',
81
- match: {
82
- namedArgs: ['on', 'regex', 'regexFlags'],
83
- prep: prepRegex(1, 2),
84
- validTypes: ['array', 'object']
85
- },
86
- // 'matchAll',
87
- normalize: {
88
- namedArgs: ['on', 'form'],
89
- prep,
90
- validTypes: ['array', 'object']
91
- },
92
- padEnd: {
93
- namedArgs: ['on', 'targetLength', 'padString'],
94
- prep,
95
- validTypes: ['array', 'object']
96
- },
97
- padStart: {
98
- namedArgs: ['on', 'targetLength', 'padString'],
99
- prep,
100
- validTypes: ['array', 'object']
101
- },
102
- repeat: {
103
- namedArgs: ['on', 'count'],
104
- prep,
105
- validTypes: ['array', 'object']
106
- },
107
- replace: {
108
- namedArgs: ['on', 'regex', 'newSubstr', 'regexFlags'],
109
- prep: prepRegex(1, 3),
110
- validTypes: ['array', 'object']
111
- },
112
- search: {
113
- namedArgs: ['on', 'regex', 'regexFlags'],
114
- prep: prepRegex(1, 2),
115
- validTypes: ['array', 'object']
116
- },
117
- slice: {
118
- namedArgs: ['on', 'start', 'end'],
119
- prep,
120
- validTypes: ['array', 'object']
121
- },
122
- split: {
123
- namedArgs: ['on', 'separator'],
124
- prep,
125
- validTypes: ['array', 'object']
126
- },
127
- startsWith: {
128
- namedArgs: ['on', 'searchString', 'position'],
129
- prep,
130
- validTypes: ['array', 'object']
131
- },
132
- substring: {
133
- namedArgs: ['on', 'start', 'end'],
134
- prep,
135
- validTypes: ['array', 'object']
136
- },
137
- // toLocaleLowerCase: { namedArgs: ['on', 'locale'], validTypes: ['array', 'object'] },
138
- // toLocaleUpperCase: { namedArgs: ['on', 'locale'], validTypes: ['array', 'object'] },
139
- toLowerCase: {
140
- validTypes: ['string'],
141
- singleArg: true,
142
- prep
143
- },
144
- toUpperCase: {
145
- validTypes: ['string'],
146
- singleArg: true,
147
- prep
148
- },
149
- trim: {
150
- validTypes: ['string'],
151
- singleArg: true,
152
- prep
153
- },
154
- trimEnd: {
155
- validTypes: ['string'],
156
- singleArg: true,
157
- prep
158
- },
159
- trimStart: {
160
- validTypes: ['string'],
161
- singleArg: true,
162
- prep
163
- },
164
- length: {
165
- validTypes: ['string'],
166
- property: true,
167
- prep
168
- }
169
- };
170
-
171
- function _string(_ref) {
172
- var {
173
- params,
174
- location,
175
- methodName
176
- } = _ref;
177
- return (0, _runInstance.default)({
178
- location,
179
- meta,
180
- methodName,
181
- operator: '_string',
182
- params,
183
- instanceType: 'string'
184
- });
185
- }
186
-
187
- var _default = _string;
188
- exports.default = _default;
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _subtract(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _subtract takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- if (params.length !== 2) {
36
- throw new Error("Operator Error: _subtract takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- if (!_helpers.type.isNumber(params[0]) || !_helpers.type.isNumber(params[1])) {
40
- throw new Error("Operator Error: _subtract takes an array of 2 numbers. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
41
- }
42
-
43
- return params[0] - params[1];
44
- }
45
-
46
- var _default = _subtract;
47
- exports.default = _default;
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _sum(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _sum takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- return params.reduce((accumulator, value) => {
36
- if (_helpers.type.isNumber(value)) {
37
- return accumulator + value;
38
- }
39
-
40
- return accumulator;
41
- }, 0);
42
- }
43
-
44
- var _default = _sum;
45
- exports.default = _default;