@lowdefy/operators 3.22.0 → 4.0.0-alpha.1

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 (75) hide show
  1. package/dist/common/and.js +8 -24
  2. package/dist/common/args.js +10 -31
  3. package/dist/common/array.js +244 -153
  4. package/dist/common/change_case.js +114 -160
  5. package/dist/common/date.js +33 -54
  6. package/dist/common/divide.js +16 -36
  7. package/dist/common/eq.js +10 -28
  8. package/dist/common/function.js +27 -59
  9. package/dist/common/get.js +21 -46
  10. package/dist/common/gt.js +10 -28
  11. package/dist/common/gte.js +10 -28
  12. package/dist/common/if.js +9 -26
  13. package/dist/common/if_none.js +13 -32
  14. package/dist/common/index.js +39 -53
  15. package/dist/common/json.js +53 -57
  16. package/dist/common/log.js +5 -18
  17. package/dist/common/lt.js +10 -28
  18. package/dist/common/lte.js +10 -28
  19. package/dist/common/math.js +255 -194
  20. package/dist/common/mql.js +93 -102
  21. package/dist/common/ne.js +10 -28
  22. package/dist/common/not.js +3 -16
  23. package/dist/common/number.js +130 -108
  24. package/dist/common/nunjucks.js +24 -44
  25. package/dist/common/object.js +89 -98
  26. package/dist/common/operator.js +33 -44
  27. package/dist/common/or.js +8 -24
  28. package/dist/common/product.js +11 -29
  29. package/dist/common/random.js +74 -109
  30. package/dist/common/regex.js +26 -49
  31. package/dist/common/string.js +270 -171
  32. package/dist/common/subtract.js +13 -32
  33. package/dist/common/sum.js +11 -29
  34. package/dist/common/switch.js +30 -0
  35. package/dist/common/type.js +36 -67
  36. package/dist/common/uri.js +29 -46
  37. package/dist/common/user.js +10 -35
  38. package/dist/common/uuid.js +48 -59
  39. package/dist/common/yaml.js +56 -63
  40. package/dist/getFromArray.js +22 -44
  41. package/dist/getFromObject.js +25 -70
  42. package/dist/index.js +14 -20
  43. package/dist/node/base64.js +31 -48
  44. package/dist/node/diff.js +30 -47
  45. package/dist/node/hash.js +55 -71
  46. package/dist/node/index.js +6 -14
  47. package/dist/{web/list_contexts.js → node/payload.js} +9 -16
  48. package/dist/node/secret.js +32 -53
  49. package/dist/nodeParser.js +95 -146
  50. package/dist/runClass.js +57 -82
  51. package/dist/runInstance.js +60 -84
  52. package/dist/web/_index.js +25 -0
  53. package/dist/web/actions.js +10 -31
  54. package/dist/web/base64.js +29 -46
  55. package/dist/{common/_index.js → web/event.js} +10 -30
  56. package/dist/web/event_log.js +10 -35
  57. package/dist/web/format.js +15 -37
  58. package/dist/web/global.js +25 -0
  59. package/dist/web/index.js +17 -21
  60. package/dist/{common/event.js → web/input.js} +10 -31
  61. package/dist/web/js.js +10 -30
  62. package/dist/web/location.js +44 -59
  63. package/dist/web/media.js +46 -75
  64. package/dist/web/menu.js +10 -28
  65. package/dist/web/request.js +19 -40
  66. package/dist/web/request_details.js +10 -35
  67. package/dist/web/state.js +25 -0
  68. package/dist/web/url_query.js +25 -0
  69. package/dist/webParser.js +115 -157
  70. package/package.json +16 -15
  71. package/dist/common/global.js +0 -50
  72. package/dist/common/input.js +0 -50
  73. package/dist/common/state.js +0 -50
  74. package/dist/common/url_query.js +0 -50
  75. package/dist/getFromOtherContext.js +0 -96
@@ -1,18 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _changeCase = require("change-case");
9
-
10
- var _helpers = require("@lowdefy/helpers");
11
-
12
- var _runClass = _interopRequireDefault(require("../runClass"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
1
  /*
17
2
  Copyright 2020-2021 Lowdefy, Inc
18
3
 
@@ -27,159 +12,128 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
27
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
13
  See the License for the specific language governing permissions and
29
14
  limitations under the License.
30
- */
31
-
32
- /* eslint-disable import/namespace */
33
- var changeCase = {
34
- camelCase: _changeCase.camelCase,
35
- capitalCase: _changeCase.capitalCase,
36
- constantCase: _changeCase.constantCase,
37
- dotCase: _changeCase.dotCase,
38
- headerCase: _changeCase.headerCase,
39
- noCase: _changeCase.noCase,
40
- paramCase: _changeCase.paramCase,
41
- pascalCase: _changeCase.pascalCase,
42
- pathCase: _changeCase.pathCase,
43
- sentenceCase: _changeCase.sentenceCase,
44
- snakeCase: _changeCase.snakeCase
15
+ */ /* eslint-disable import/namespace */ import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
16
+ import { get, type } from '@lowdefy/helpers';
17
+ import runClass from '../runClass.js';
18
+ const changeCase = {
19
+ camelCase,
20
+ capitalCase,
21
+ constantCase,
22
+ dotCase,
23
+ headerCase,
24
+ noCase,
25
+ paramCase,
26
+ pascalCase,
27
+ pathCase,
28
+ sentenceCase,
29
+ snakeCase
45
30
  };
46
-
47
- var prepRegex = (prop, location) => {
48
- var regex = _helpers.type.isString(prop) ? {
49
- pattern: prop
50
- } : prop;
51
-
52
- if (!_helpers.type.isObject(regex)) {
53
- throw new Error("Operator Error: regex must be string or an object. Received ".concat(JSON.stringify(prop), " at ").concat(location, "."));
54
- }
55
-
56
- try {
57
- return new RegExp(regex.pattern, regex.flags || 'gm');
58
- } catch (e) {
59
- throw new Error("Operator Error: ".concat(e.message, ". Received: ").concat(JSON.stringify(prop), " at ").concat(location, "."));
60
- }
61
- };
62
-
63
- var prep = (args, _ref) => {
64
- var {
65
- location
66
- } = _ref;
67
- var options = args[1];
68
-
69
- if (!_helpers.type.isNone(options) && !_helpers.type.isObject(options)) {
70
- throw new Error("Operator Error: options must be an object. Received ".concat(JSON.stringify(options), " at ").concat(location, "."));
71
- }
72
-
73
- if (_helpers.type.isObject(options)) {
74
- if (options.splitRegexp) {
75
- options.splitRegexp = prepRegex(options.splitRegexp, location);
31
+ const prepRegex = (prop, location)=>{
32
+ const regex = type.isString(prop) ? {
33
+ pattern: prop
34
+ } : prop;
35
+ if (!type.isObject(regex)) {
36
+ throw new Error(`Operator Error: regex must be string or an object. Received ${JSON.stringify(prop)} at ${location}.`);
76
37
  }
77
-
78
- if (options.stripRegexp) {
79
- options.stripRegexp = prepRegex(options.stripRegexp, location);
38
+ try {
39
+ return new RegExp(regex.pattern, regex.flags || 'gm');
40
+ } catch (e) {
41
+ throw new Error(`Operator Error: ${e.message}. Received: ${JSON.stringify(prop)} at ${location}.`);
80
42
  }
81
- }
82
-
83
- return args;
84
43
  };
85
-
86
- var convertArray = _ref2 => {
87
- var {
88
- methodName,
89
- on,
90
- options
91
- } = _ref2;
92
- return on.map(item => {
93
- if (_helpers.type.isString(item)) {
94
- return changeCase[methodName](item, options);
44
+ const prep = (args, { location })=>{
45
+ const options = args[1];
46
+ if (!type.isNone(options) && !type.isObject(options)) {
47
+ throw new Error(`Operator Error: options must be an object. Received ${JSON.stringify(options)} at ${location}.`);
95
48
  }
96
-
97
- return item;
98
- });
99
- };
100
-
101
- var convertObject = _ref3 => {
102
- var {
103
- methodName,
104
- on,
105
- options
106
- } = _ref3;
107
- var result = {};
108
- var keyConverter = (0, _helpers.get)(options, 'convertKeys') ? key => changeCase[methodName](key, options) : key => key;
109
- var valueConverter = (0, _helpers.get)(options, 'convertValues', {
110
- default: true
111
- }) ? val => changeCase[methodName](val, options) : val => val;
112
- Object.entries(on).forEach(_ref4 => {
113
- var [key, value] = _ref4;
114
-
115
- if (_helpers.type.isString(value)) {
116
- result[keyConverter(key)] = valueConverter(value);
117
- } else {
118
- result[keyConverter(key)] = value;
49
+ if (type.isObject(options)) {
50
+ if (options.splitRegexp) {
51
+ options.splitRegexp = prepRegex(options.splitRegexp, location);
52
+ }
53
+ if (options.stripRegexp) {
54
+ options.stripRegexp = prepRegex(options.stripRegexp, location);
55
+ }
119
56
  }
120
- });
121
- return result;
57
+ return args;
122
58
  };
123
-
124
- var makeCaseChanger = _ref5 => {
125
- var {
126
- methodName
127
- } = _ref5;
128
- return function (on) {
129
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
130
-
131
- if (_helpers.type.isString(on)) {
132
- return changeCase[methodName](on, options);
133
- }
134
-
135
- if (_helpers.type.isArray(on)) {
136
- return convertArray({
137
- methodName,
138
- on,
139
- options
140
- });
141
- }
142
-
143
- if (_helpers.type.isObject(on)) {
144
- return convertObject({
145
- methodName,
146
- on,
147
- options
148
- });
59
+ const convertArray = ({ methodName , on , options })=>{
60
+ return on.map((item)=>{
61
+ if (type.isString(item)) {
62
+ return changeCase[methodName](item, options);
63
+ }
64
+ return item;
65
+ });
66
+ };
67
+ const convertObject = ({ methodName , on , options })=>{
68
+ const result = {
69
+ };
70
+ const keyConverter = get(options, 'convertKeys') ? (key)=>changeCase[methodName](key, options)
71
+ : (key)=>key
72
+ ;
73
+ const valueConverter = get(options, 'convertValues', {
74
+ default: true
75
+ }) ? (val)=>changeCase[methodName](val, options)
76
+ : (val)=>val
77
+ ;
78
+ Object.entries(on).forEach(([key, value])=>{
79
+ if (type.isString(value)) {
80
+ result[keyConverter(key)] = valueConverter(value);
81
+ } else {
82
+ result[keyConverter(key)] = value;
83
+ }
84
+ });
85
+ return result;
86
+ };
87
+ const makeCaseChanger = ({ methodName })=>(on, options = {
88
+ })=>{
89
+ if (type.isString(on)) {
90
+ return changeCase[methodName](on, options);
91
+ }
92
+ if (type.isArray(on)) {
93
+ return convertArray({
94
+ methodName,
95
+ on,
96
+ options
97
+ });
98
+ }
99
+ if (type.isObject(on)) {
100
+ return convertObject({
101
+ methodName,
102
+ on,
103
+ options
104
+ });
105
+ }
106
+ return on;
149
107
  }
150
-
151
- return on;
152
- };
108
+ ;
109
+ const functions = {
153
110
  };
154
-
155
- var functions = {};
156
- var meta = {};
157
- Object.keys(changeCase).forEach(methodName => {
158
- functions[methodName] = makeCaseChanger({
159
- methodName
160
- });
161
- meta[methodName] = {
162
- namedArgs: ['on', 'options'],
163
- validTypes: ['array', 'object'],
164
- prep
165
- };
111
+ const meta = {
112
+ };
113
+ Object.keys(changeCase).forEach((methodName)=>{
114
+ functions[methodName] = makeCaseChanger({
115
+ methodName
116
+ });
117
+ meta[methodName] = {
118
+ namedArgs: [
119
+ 'on',
120
+ 'options'
121
+ ],
122
+ validTypes: [
123
+ 'array',
124
+ 'object'
125
+ ],
126
+ prep
127
+ };
166
128
  });
167
-
168
- function change_case(_ref6) {
169
- var {
170
- params,
171
- location,
172
- methodName
173
- } = _ref6;
174
- return (0, _runClass.default)({
175
- functions,
176
- location,
177
- meta,
178
- methodName,
179
- operator: '_change_case',
180
- params
181
- });
129
+ function change_case({ params , location , methodName }) {
130
+ return runClass({
131
+ functions,
132
+ location,
133
+ meta,
134
+ methodName,
135
+ operator: '_change_case',
136
+ params
137
+ });
182
138
  }
183
-
184
- var _default = change_case;
185
- exports.default = _default;
139
+ export default change_case;
@@ -1,16 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _runClass = _interopRequireDefault(require("../runClass"));
9
-
10
- var _helpers = require("@lowdefy/helpers");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
1
  /*
15
2
  Copyright 2020-2021 Lowdefy, Inc
16
3
 
@@ -25,51 +12,43 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
13
  See the License for the specific language governing permissions and
27
14
  limitations under the License.
28
- */
15
+ */ import { type } from '@lowdefy/helpers';
16
+ import runClass from '../runClass.js';
29
17
  function date(input) {
30
- var result = new Date(input);
31
-
32
- if (!_helpers.type.isDate(result)) {
33
- throw new Error("".concat(input, " could not resolve as a valid javascript date."));
34
- }
35
-
36
- return result;
18
+ const result = new Date(input);
19
+ if (!type.isDate(result)) {
20
+ throw new Error(`${input} could not resolve as a valid javascript date.`);
21
+ }
22
+ return result;
37
23
  }
38
-
39
24
  function now() {
40
- return new Date();
25
+ return new Date();
41
26
  }
42
-
43
- var functions = {
44
- __default: date,
45
- now
27
+ const functions = {
28
+ __default: date,
29
+ now
46
30
  };
47
- var meta = {
48
- __default: {
49
- singleArg: true,
50
- validTypes: ['number', 'string']
51
- },
52
- now: {
53
- noArgs: true
54
- }
31
+ const meta = {
32
+ __default: {
33
+ singleArg: true,
34
+ validTypes: [
35
+ 'number',
36
+ 'string'
37
+ ]
38
+ },
39
+ now: {
40
+ noArgs: true
41
+ }
55
42
  };
56
-
57
- function _date(_ref) {
58
- var {
59
- params,
60
- location,
61
- methodName
62
- } = _ref;
63
- return (0, _runClass.default)({
64
- functions,
65
- location,
66
- meta,
67
- methodName: methodName,
68
- operator: '_date',
69
- params,
70
- defaultFunction: '__default'
71
- });
43
+ function _date({ params , location , methodName }) {
44
+ return runClass({
45
+ functions,
46
+ location,
47
+ meta,
48
+ methodName: methodName,
49
+ operator: '_date',
50
+ params,
51
+ defaultFunction: '__default'
52
+ });
72
53
  }
73
-
74
- var _default = _date;
75
- exports.default = _default;
54
+ export default _date;
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,31 +12,20 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
25
- function _divide(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _divide 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: _divide 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: _divide takes an array of 2 numbers. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
41
- }
42
-
43
- if (params[1] === 0) {
44
- throw new Error("Operator Error: _divide by zero not allowed. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
45
- }
46
-
47
- return params[0] / params[1];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _divide({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _divide takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _divide takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ if (!type.isNumber(params[0]) || !type.isNumber(params[1])) {
24
+ throw new Error(`Operator Error: _divide takes an array of 2 numbers. Received: ${JSON.stringify(params)} at ${location}.`);
25
+ }
26
+ if (params[1] === 0) {
27
+ throw new Error(`Operator Error: _divide by zero not allowed. Received: ${JSON.stringify(params)} at ${location}.`);
28
+ }
29
+ return params[0] / params[1];
48
30
  }
49
-
50
- var _default = _divide;
51
- exports.default = _default;
31
+ export default _divide;
package/dist/common/eq.js CHANGED
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,23 +12,14 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
25
- function _eq(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _eq 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: _eq takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] === params[1];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _eq({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _eq takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _eq takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ return params[0] === params[1];
40
24
  }
41
-
42
- var _default = _eq;
43
- exports.default = _default;
25
+ export default _eq;
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,58 +12,35 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
15
+ */ import { serializer, type } from '@lowdefy/helpers';
25
16
  function removeUnderscore(_, value) {
26
- if (_helpers.type.isObject(value) && Object.keys(value).length === 1) {
27
- var key = Object.keys(value)[0];
28
-
29
- if (key.startsWith('__')) {
30
- var newKey = key.substring(1);
31
- return {
32
- [newKey]: value[key]
33
- };
17
+ if (type.isObject(value) && Object.keys(value).length === 1) {
18
+ const key = Object.keys(value)[0];
19
+ if (key.startsWith('__')) {
20
+ const newKey = key.substring(1);
21
+ return {
22
+ [newKey]: value[key]
23
+ };
24
+ }
34
25
  }
35
- }
36
-
37
- return value;
26
+ return value;
38
27
  }
39
-
40
- function _function(_ref) {
41
- var {
42
- arrayIndices,
43
- event,
44
- location,
45
- params,
46
- parser
47
- } = _ref;
48
-
49
- var preparedParams = _helpers.serializer.copy(params, {
50
- reviver: removeUnderscore
51
- });
52
-
53
- return function () {
54
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- var {
59
- output,
60
- errors
61
- } = parser.parse({
62
- arrayIndices,
63
- args,
64
- event,
65
- input: preparedParams,
66
- location
28
+ function _function({ arrayIndices , event , location , params , parser }) {
29
+ const preparedParams = serializer.copy(params, {
30
+ reviver: removeUnderscore
67
31
  });
68
-
69
- if (errors.length > 0) {
70
- throw new Error(errors[0]);
71
- }
72
-
73
- return output;
74
- };
32
+ return (...args)=>{
33
+ const { output , errors } = parser.parse({
34
+ arrayIndices,
35
+ args,
36
+ event,
37
+ input: preparedParams,
38
+ location
39
+ });
40
+ if (errors.length > 0) {
41
+ throw new Error(errors[0]);
42
+ }
43
+ return output;
44
+ };
75
45
  }
76
-
77
- var _default = _function;
78
- exports.default = _default;
46
+ export default _function;
@@ -1,16 +1,3 @@
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
- var _getFromObject = _interopRequireDefault(require("../getFromObject"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
1
  /*
15
2
  Copyright 2020-2021 Lowdefy, Inc
16
3
 
@@ -25,37 +12,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
13
  See the License for the specific language governing permissions and
27
14
  limitations under the License.
28
- */
29
- function _get(_ref) {
30
- var {
31
- arrayIndices,
32
- env,
33
- location,
34
- params
35
- } = _ref;
36
-
37
- if (!_helpers.type.isObject(params)) {
38
- throw new Error("Operator Error: _get takes an object as params. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
39
- }
40
-
41
- if (params.from === null) return (0, _helpers.get)(params, 'default', {
42
- default: null,
43
- copy: true
44
- });
45
-
46
- if (!_helpers.type.isObject(params.from) && !_helpers.type.isArray(params.from)) {
47
- throw new Error("Operator Error: _get.from is not an object or array. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
48
- }
49
-
50
- return (0, _getFromObject.default)({
51
- arrayIndices,
52
- env,
53
- location,
54
- object: params.from,
55
- operator: '_get',
56
- params
57
- });
15
+ */ import { get, type } from '@lowdefy/helpers';
16
+ import getFromObject from '../getFromObject.js';
17
+ function _get({ arrayIndices , location , params }) {
18
+ if (!type.isObject(params)) {
19
+ throw new Error(`Operator Error: _get takes an object as params. Received: ${JSON.stringify(params)} at ${location}.`);
20
+ }
21
+ if (params.from === null) return get(params, 'default', {
22
+ default: null,
23
+ copy: true
24
+ });
25
+ if (!type.isObject(params.from) && !type.isArray(params.from)) {
26
+ throw new Error(`Operator Error: _get.from is not an object or array. Received: ${JSON.stringify(params)} at ${location}.`);
27
+ }
28
+ return getFromObject({
29
+ arrayIndices,
30
+ location,
31
+ object: params.from,
32
+ operator: '_get',
33
+ params
34
+ });
58
35
  }
59
-
60
- var _default = _get;
61
- exports.default = _default;
36
+ export default _get;