@lowdefy/operators 3.22.0 → 3.23.2

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.
@@ -58,6 +58,7 @@ var _default = {
58
58
  _string: 'common/string',
59
59
  _subtract: 'common/subtract',
60
60
  _sum: 'common/sum',
61
+ _switch: 'common/switch',
61
62
  _type: 'common/type',
62
63
  _uri: 'common/uri',
63
64
  _url_query: 'common/url_query',
@@ -0,0 +1,49 @@
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 _switch(_ref) {
26
+ var {
27
+ location,
28
+ params
29
+ } = _ref;
30
+
31
+ if (!_helpers.type.isArray(params.branches)) {
32
+ throw new Error("Operator Error: switch takes an array type as input for the branches. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
+ }
34
+
35
+ for (var branch of params.branches) {
36
+ if (!_helpers.type.isBoolean(branch.if)) {
37
+ throw new Error("Operator Error: switch takes a boolean type for parameter test. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
38
+ }
39
+
40
+ if (branch.if === true) {
41
+ return branch.then;
42
+ }
43
+ }
44
+
45
+ return params.default;
46
+ }
47
+
48
+ var _default = _switch;
49
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators",
3
- "version": "3.22.0",
3
+ "version": "3.23.2",
4
4
  "licence": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -36,9 +36,9 @@
36
36
  "prepare": "yarn build"
37
37
  },
38
38
  "dependencies": {
39
- "@lowdefy/format": "3.22.0",
40
- "@lowdefy/helpers": "3.22.0",
41
- "@lowdefy/nunjucks": "3.22.0",
39
+ "@lowdefy/format": "3.23.2",
40
+ "@lowdefy/helpers": "3.23.2",
41
+ "@lowdefy/nunjucks": "3.23.2",
42
42
  "change-case": "4.1.2",
43
43
  "deep-diff": "1.0.2",
44
44
  "js-yaml": "4.1.0",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "af37daa86e1ba73397eb65f65cacbcbb5461ec79"
58
+ "gitHead": "4c30d3cdfa99ae4e90fc891825938c28bad45760"
59
59
  }