sculp-js 1.12.0 → 1.13.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 (63) hide show
  1. package/lib/cjs/array.js +1 -1
  2. package/lib/cjs/async.js +4 -4
  3. package/lib/cjs/base64.js +1 -1
  4. package/lib/cjs/clipboard.js +1 -1
  5. package/lib/cjs/cloneDeep.js +1 -1
  6. package/lib/cjs/cookie.js +1 -1
  7. package/lib/cjs/date.js +1 -1
  8. package/lib/cjs/dom.js +1 -1
  9. package/lib/cjs/download.js +1 -1
  10. package/lib/cjs/easing.js +1 -1
  11. package/lib/cjs/file.js +1 -1
  12. package/lib/cjs/func.js +1 -1
  13. package/lib/cjs/index.js +1 -1
  14. package/lib/cjs/isEqual.js +1 -1
  15. package/lib/cjs/math.js +1 -1
  16. package/lib/cjs/number.js +1 -1
  17. package/lib/cjs/object.js +1 -1
  18. package/lib/cjs/path.js +1 -1
  19. package/lib/cjs/qs.js +1 -1
  20. package/lib/cjs/random.js +1 -1
  21. package/lib/cjs/string.js +1 -1
  22. package/lib/cjs/tooltip.js +1 -1
  23. package/lib/cjs/tree.js +142 -59
  24. package/lib/cjs/type.js +1 -1
  25. package/lib/cjs/unique.js +1 -1
  26. package/lib/cjs/url.js +1 -1
  27. package/lib/cjs/validator.js +1 -1
  28. package/lib/cjs/variable.js +1 -1
  29. package/lib/cjs/watermark.js +1 -1
  30. package/lib/cjs/we-decode.js +1 -1
  31. package/lib/es/array.js +1 -1
  32. package/lib/es/async.js +4 -4
  33. package/lib/es/base64.js +1 -1
  34. package/lib/es/clipboard.js +1 -1
  35. package/lib/es/cloneDeep.js +1 -1
  36. package/lib/es/cookie.js +1 -1
  37. package/lib/es/date.js +1 -1
  38. package/lib/es/dom.js +1 -1
  39. package/lib/es/download.js +1 -1
  40. package/lib/es/easing.js +1 -1
  41. package/lib/es/file.js +1 -1
  42. package/lib/es/func.js +1 -1
  43. package/lib/es/index.js +1 -1
  44. package/lib/es/isEqual.js +1 -1
  45. package/lib/es/math.js +1 -1
  46. package/lib/es/number.js +1 -1
  47. package/lib/es/object.js +1 -1
  48. package/lib/es/path.js +1 -1
  49. package/lib/es/qs.js +1 -1
  50. package/lib/es/random.js +1 -1
  51. package/lib/es/string.js +1 -1
  52. package/lib/es/tooltip.js +1 -1
  53. package/lib/es/tree.js +143 -60
  54. package/lib/es/type.js +1 -1
  55. package/lib/es/unique.js +1 -1
  56. package/lib/es/url.js +1 -1
  57. package/lib/es/validator.js +1 -1
  58. package/lib/es/variable.js +1 -1
  59. package/lib/es/watermark.js +1 -1
  60. package/lib/es/we-decode.js +1 -1
  61. package/lib/index.d.ts +41 -24
  62. package/lib/umd/index.js +2 -2
  63. package/package.json +1 -1
package/lib/cjs/array.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/async.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -62,16 +62,16 @@ function asyncMap(list, mapper, concurrency = Infinity) {
62
62
  * Execute a promise safely
63
63
  *
64
64
  * @param { Promise } promise
65
- * @param { Object= } errorExt - Additional Information you can pass to the err object
65
+ * @param { Object= } errorExt - Additional Information you can pass safeAwait the err object
66
66
  * @return { Promise }
67
67
  * @example
68
68
  * async function asyncTaskWithCb(cb) {
69
69
  let err, user, savedTask, notification;
70
70
 
71
- [ err, user ] = await to(UserModel.findById(1));
71
+ [ err, user ] = await safeAwait(UserModel.findById(1));
72
72
  if(!user) return cb('No user found');
73
73
 
74
- [ err, savedTask ] = await to(TaskModel({userId: user.id, name: 'Demo Task'}));
74
+ [ err, savedTask ] = await safeAwait(TaskModel({userId: user.id, name: 'Demo Task'}));
75
75
  if(err) return cb('Error occurred while saving task')
76
76
 
77
77
  cb(null, savedTask);
package/lib/cjs/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/cookie.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/easing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/file.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/func.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/math.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/number.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/object.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/path.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/qs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/random.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/string.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/tree.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -17,58 +17,126 @@ const defaultSearchTreeOptions = {
17
17
  ignoreCase: true
18
18
  };
19
19
  /**
20
- * 深度优先遍历函数(支持continue和break操作), 可用于insert tree item 和 remove tree item
20
+ * 树遍历函数(支持continue和break操作), 可用于insert tree item 和 remove tree item
21
21
  * @param {ArrayLike<V>} tree 树形数据
22
22
  * @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
23
- * @param {string} children 定制子元素的key
24
- * @param {boolean} isReverse 是否反向遍历
23
+ * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
24
+ childField: 'children',
25
+ reverse: false,
26
+ breadthFirst: false
27
+ }
25
28
  * @returns {*}
26
29
  */
27
- function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
30
+ function forEachDeep(tree, iterator, options = {
31
+ childField: 'children',
32
+ reverse: false,
33
+ breadthFirst: false
34
+ }) {
35
+ const { childField = 'children', reverse = false, breadthFirst = false } = type.isObject(options) ? options : {};
28
36
  let isBreak = false;
37
+ const queue = [];
29
38
  const walk = (arr, parent, level = 0) => {
30
- if (isReverse) {
31
- for (let i = arr.length - 1; i >= 0; i--) {
39
+ if (reverse) {
40
+ for (let index = arr.length - 1; index >= 0; index--) {
32
41
  if (isBreak) {
33
42
  break;
34
43
  }
35
- const re = iterator(arr[i], i, arr, tree, parent, level);
36
- if (re === false) {
37
- isBreak = true;
38
- break;
44
+ const item = arr[index];
45
+ // 广度优先
46
+ if (breadthFirst) {
47
+ queue.push({ item, index, array: arr, tree, parent, level });
39
48
  }
40
- else if (re === true) {
41
- continue;
49
+ else {
50
+ const re = iterator(item, index, arr, tree, parent, level);
51
+ if (re === false) {
52
+ isBreak = true;
53
+ break;
54
+ }
55
+ else if (re === true) {
56
+ continue;
57
+ }
58
+ // @ts-ignore
59
+ if (item && Array.isArray(item[childField])) {
60
+ // @ts-ignore
61
+ walk(item[childField], item, level + 1);
62
+ }
42
63
  }
43
- // @ts-ignore
44
- if (arr[i] && Array.isArray(arr[i][children])) {
64
+ }
65
+ if (breadthFirst) {
66
+ // Process queue
67
+ while (queue.length > 0 && !isBreak) {
68
+ const current = queue.shift();
69
+ // iterate(info);
70
+ // @ts-ignore
71
+ const { item, index, array, tree, parent, level } = current;
72
+ const re = iterator(item, index, array, tree, parent, level);
73
+ if (re === false) {
74
+ isBreak = true;
75
+ break;
76
+ }
77
+ else if (re === true) {
78
+ continue;
79
+ }
45
80
  // @ts-ignore
46
- walk(arr[i][children], arr[i], level + 1);
81
+ if (item && Array.isArray(item[childField])) {
82
+ // @ts-ignore
83
+ walk(item[childField], item, level + 1);
84
+ }
47
85
  }
48
86
  }
49
87
  }
50
88
  else {
51
- for (let i = 0, len = arr.length; i < len; i++) {
89
+ for (let index = 0, len = arr.length; index < len; index++) {
52
90
  if (isBreak) {
53
91
  break;
54
92
  }
55
- const re = iterator(arr[i], i, arr, tree, parent, level);
56
- if (re === false) {
57
- isBreak = true;
58
- break;
93
+ const item = arr[index];
94
+ if (breadthFirst) {
95
+ // 广度优先
96
+ queue.push({ item, index: index, array: arr, tree, parent, level });
59
97
  }
60
- else if (re === true) {
61
- continue;
98
+ else {
99
+ // 深度优先
100
+ const re = iterator(item, index, arr, tree, parent, level);
101
+ if (re === false) {
102
+ isBreak = true;
103
+ break;
104
+ }
105
+ else if (re === true) {
106
+ continue;
107
+ }
108
+ // @ts-ignore
109
+ if (item && Array.isArray(item[childField])) {
110
+ // @ts-ignore
111
+ walk(item[childField], item, level + 1);
112
+ }
62
113
  }
63
- // @ts-ignore
64
- if (arr[i] && Array.isArray(arr[i][children])) {
114
+ }
115
+ if (breadthFirst) {
116
+ while (queue.length > 0 && !isBreak) {
117
+ const current = queue.shift();
118
+ if (!current)
119
+ break;
120
+ // @ts-ignore
121
+ const { item, index, array, tree, parent, level } = current;
122
+ const re = iterator(item, index, array, tree, parent, level);
123
+ if (re === false) {
124
+ isBreak = true;
125
+ break;
126
+ }
127
+ else if (re === true) {
128
+ continue;
129
+ }
65
130
  // @ts-ignore
66
- walk(arr[i][children], arr[i], level + 1);
131
+ if (item && Array.isArray(item[childField])) {
132
+ // @ts-ignore
133
+ walk(item[childField], item, level + 1);
134
+ }
67
135
  }
68
136
  }
69
137
  }
70
138
  };
71
- walk(tree, null);
139
+ walk(tree, null, 0);
72
140
  // @ts-ignore
73
141
  tree = null;
74
142
  }
@@ -78,20 +146,27 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
78
146
  * 可遍历任何带有 length 属性和数字键的类数组对象
79
147
  * @param {ArrayLike<V>} tree 树形数据
80
148
  * @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
81
- * @param {string} children 定制子元素的key
82
- * @param {boolean} isReverse 是否反向遍历
149
+ * @param {options} options 支持定制子元素名称、反向遍历,默认{
150
+ childField: 'children',
151
+ reverse: false,
152
+ }
83
153
  * @returns {any[]} 新的一棵树
84
154
  */
85
- function mapDeep(tree, iterator, children = 'children', isReverse = false) {
155
+ function mapDeep(tree, iterator, options = {
156
+ childField: 'children',
157
+ reverse: false
158
+ }) {
159
+ const { childField = 'children', reverse = false } = type.isObject(options) ? options : {};
86
160
  let isBreak = false;
87
161
  const newTree = [];
88
162
  const walk = (arr, parent, newTree, level = 0) => {
89
- if (isReverse) {
163
+ if (reverse) {
90
164
  for (let i = arr.length - 1; i >= 0; i--) {
91
165
  if (isBreak) {
92
166
  break;
93
167
  }
94
- const re = iterator(arr[i], i, arr, tree, parent, level);
168
+ const item = arr[i];
169
+ const re = iterator(item, i, arr, tree, parent, level);
95
170
  if (re === false) {
96
171
  isBreak = true;
97
172
  break;
@@ -99,16 +174,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
99
174
  else if (re === true) {
100
175
  continue;
101
176
  }
102
- newTree.push(object.objectOmit(re, [children]));
177
+ newTree.push(object.objectOmit(re, [childField]));
103
178
  // @ts-ignore
104
- if (arr[i] && Array.isArray(arr[i][children])) {
105
- newTree[newTree.length - 1][children] = [];
179
+ if (item && Array.isArray(item[childField])) {
180
+ newTree[newTree.length - 1][childField] = [];
106
181
  // @ts-ignore
107
- walk(arr[i][children], arr[i], newTree[newTree.length - 1][children], level + 1);
182
+ walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
108
183
  }
109
184
  else {
110
185
  // children非有效数组时,移除该属性字段
111
- delete re[children];
186
+ delete re[childField];
112
187
  }
113
188
  }
114
189
  }
@@ -117,7 +192,8 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
117
192
  if (isBreak) {
118
193
  break;
119
194
  }
120
- const re = iterator(arr[i], i, arr, tree, parent, level);
195
+ const item = arr[i];
196
+ const re = iterator(item, i, arr, tree, parent, level);
121
197
  if (re === false) {
122
198
  isBreak = true;
123
199
  break;
@@ -125,16 +201,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
125
201
  else if (re === true) {
126
202
  continue;
127
203
  }
128
- newTree.push(object.objectOmit(re, [children]));
204
+ newTree.push(object.objectOmit(re, [childField]));
129
205
  // @ts-ignore
130
- if (arr[i] && Array.isArray(arr[i][children])) {
131
- newTree[newTree.length - 1][children] = [];
206
+ if (item && Array.isArray(item[childField])) {
207
+ newTree[newTree.length - 1][childField] = [];
132
208
  // @ts-ignore
133
- walk(arr[i][children], arr[i], newTree[newTree.length - 1][children], level + 1);
209
+ walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
134
210
  }
135
211
  else {
136
212
  // children非有效数组时,移除该属性字段
137
- delete re[children];
213
+ delete re[childField];
138
214
  }
139
215
  }
140
216
  }
@@ -148,30 +224,30 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
148
224
  * 在树中找到 id 为某个值的节点,并返回上游的所有父级节点
149
225
  *
150
226
  * @param {ArrayLike<T>} tree - 树形数据
151
- * @param {IdLike} nodeId - 元素ID
152
- * @param {ITreeConf} config - 迭代配置项
153
- * @returns {[IdLike[], ITreeItem<V>[]]} - 由parentId...childId, parentObject-childObject组成的二维数组
227
+ * @param {number | string} nodeId - 目标元素ID
228
+ * @param {ITreeConf} options - 迭代配置项, 默认:{ children = 'children', id = 'id' }
229
+ * @returns {[(number | string)[], V[]]} - 由parentId...childId, parentObject-childObject组成的二维数组
154
230
  */
155
- function searchTreeById(tree, nodeId, config) {
156
- const { children = 'children', id = 'id' } = config || {};
231
+ function searchTreeById(tree, nodeId, options = { childField: 'children', keyField: 'id' }) {
232
+ const { childField = 'children', keyField = 'id' } = type.isObject(options) ? options : {};
157
233
  const toFlatArray = (tree, parentId, parent) => {
158
234
  return tree.reduce((t, _) => {
159
- const child = _[children];
235
+ const child = _[childField];
160
236
  return [
161
237
  ...t,
162
238
  parentId ? { ..._, parentId, parent } : _,
163
- ...(child && child.length ? toFlatArray(child, _[id], _) : [])
239
+ ...(child && child.length ? toFlatArray(child, _[keyField], _) : [])
164
240
  ];
165
241
  }, []);
166
242
  };
167
243
  const getIds = (flatArray) => {
168
- let child = flatArray.find(_ => _[id] === nodeId);
244
+ let child = flatArray.find(_ => _[keyField] === nodeId);
169
245
  const { parent, parentId, ...other } = child;
170
246
  let ids = [nodeId], nodes = [other];
171
247
  while (child && child.parentId) {
172
248
  ids = [child.parentId, ...ids];
173
249
  nodes = [child.parent, ...nodes];
174
- child = flatArray.find(_ => _[id] === child.parentId); // eslint-disable-line
250
+ child = flatArray.find(_ => _[keyField] === child.parentId); // eslint-disable-line
175
251
  }
176
252
  return [ids, nodes];
177
253
  };
@@ -180,11 +256,12 @@ function searchTreeById(tree, nodeId, config) {
180
256
  /**
181
257
  * 扁平化数组转换成树
182
258
  * @param {any[]} list
183
- * @param {IFieldOptions} options
259
+ * @param {IFieldOptions} options 定制id字段名,子元素字段名,父元素字段名,默认
260
+ * { keyField: 'key', childField: 'children', pidField: 'pid' }
184
261
  * @returns {any[]}
185
262
  */
186
263
  function formatTree(list, options = defaultFieldOptions) {
187
- const { keyField, childField, pidField } = options;
264
+ const { keyField = 'key', childField = 'children', pidField = 'pid' } = type.isObject(options) ? options : {};
188
265
  const treeArr = [];
189
266
  const sourceMap = {};
190
267
  for (let i = 0, len = list.length; i < len; i++) {
@@ -207,12 +284,13 @@ function formatTree(list, options = defaultFieldOptions) {
207
284
  }
208
285
  /**
209
286
  * 树形结构转扁平化
210
- * @param {any} treeList
211
- * @param {IFieldOptions} options
212
- * @returns {*}
287
+ * @param {any[]} treeList
288
+ * @param {IFieldOptions} options 定制id字段名,子元素字段名,父元素字段名,默认
289
+ * { keyField: 'key', childField: 'children', pidField: 'pid' }
290
+ * @returns {any[]}
213
291
  */
214
292
  function flatTree(treeList, options = defaultFieldOptions) {
215
- const { childField, keyField, pidField } = options;
293
+ const { keyField = 'key', childField = 'children', pidField = 'pid' } = type.isObject(options) ? options : {};
216
294
  let res = [];
217
295
  for (let i = 0, len = treeList.length; i < len; i++) {
218
296
  const node = treeList[i];
@@ -243,7 +321,12 @@ function flatTree(treeList, options = defaultFieldOptions) {
243
321
  * 2. 若无任何过滤条件或keyword模式匹配且keyword为空串,返回原对象;其他情况返回新数组
244
322
  * @param {V[]} nodes
245
323
  * @param {IFilterCondition} filterCondition
246
- * @param {ISearchTreeOpts} options
324
+ * @param {ISearchTreeOpts} options 默认配置项 {
325
+ childField: 'children',
326
+ nameField: 'name',
327
+ removeEmptyChild: false,
328
+ ignoreCase: true
329
+ }
247
330
  * @returns {V[]}
248
331
  */
249
332
  function fuzzySearchTree(nodes, filterCondition, options = defaultSearchTreeOptions) {
package/lib/cjs/type.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/unique.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/cjs/url.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/array.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/async.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -60,16 +60,16 @@ function asyncMap(list, mapper, concurrency = Infinity) {
60
60
  * Execute a promise safely
61
61
  *
62
62
  * @param { Promise } promise
63
- * @param { Object= } errorExt - Additional Information you can pass to the err object
63
+ * @param { Object= } errorExt - Additional Information you can pass safeAwait the err object
64
64
  * @return { Promise }
65
65
  * @example
66
66
  * async function asyncTaskWithCb(cb) {
67
67
  let err, user, savedTask, notification;
68
68
 
69
- [ err, user ] = await to(UserModel.findById(1));
69
+ [ err, user ] = await safeAwait(UserModel.findById(1));
70
70
  if(!user) return cb('No user found');
71
71
 
72
- [ err, savedTask ] = await to(TaskModel({userId: user.id, name: 'Demo Task'}));
72
+ [ err, savedTask ] = await safeAwait(TaskModel({userId: user.id, name: 'Demo Task'}));
73
73
  if(err) return cb('Error occurred while saving task')
74
74
 
75
75
  cb(null, savedTask);
package/lib/es/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/cookie.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.12.0
2
+ * sculp-js v1.13.1
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */