@platforma-sdk/workflow-tengo 2.8.7 → 2.8.8

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.
@@ -1,7 +1,6 @@
1
1
 
2
2
 
3
3
  plapi := import("plapi")
4
- json := import("json")
5
4
  fmt := import("fmt")
6
5
  log := import("log")
7
6
  text := import("text")
@@ -101,6 +101,49 @@ return filter(map, func(k, v) { return predicateFnK(k) && predicateFnV(v) })
101
101
 
102
102
 
103
103
 
104
+
105
+
106
+
107
+
108
+
109
+
110
+ clone := func(obj, ...ops) {
111
+ removeUndefs := false
112
+ if len(ops) == 1 {
113
+ removeUndefs = ops[0].removeUndefs
114
+ }
115
+
116
+ if is_map(obj) || ll.isStrict(obj) {
117
+ res := {}
118
+ strict := ll.isStrict(obj)
119
+ if strict {
120
+ obj = ll.fromStrict(obj)
121
+ }
122
+ for k, v in obj {
123
+ if !removeUndefs || !is_undefined(v) {
124
+ res[k] = clone(v, ops...)
125
+ }
126
+ }
127
+ if strict {
128
+ return ll.toStrict(res)
129
+ } else {
130
+ return res
131
+ }
132
+ } else if is_array(obj) {
133
+ res := []
134
+ for v in obj {
135
+ res = append(res, clone(v, ops...))
136
+ }
137
+ return res
138
+ }
139
+
140
+ return obj
141
+ }
142
+
143
+
144
+
145
+
146
+
104
147
  merge := func(...maps) {
105
148
  res := {}
106
149
  for map in maps {
@@ -140,6 +183,7 @@ export ll.toStrict({
140
183
  map : map,
141
184
  merge: merge,
142
185
  deepMerge: deepMerge,
186
+ clone: clone,
143
187
  mapKeys : mapKeys,
144
188
  mapValues : mapValues,
145
189
  filter : filter,
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "2.8.7",
3
+ "version": "2.8.8",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",