sculp-js 1.3.0 → 1.3.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.
- package/lib/cjs/tree.js +4 -6
- package/lib/es/tree.js +4 -6
- package/lib/umd/index.js +4 -6
- package/package.json +1 -1
package/lib/cjs/tree.js
CHANGED
|
@@ -16,8 +16,8 @@ const defaultFieldOptions = { keyField: 'key', childField: 'children', pidField:
|
|
|
16
16
|
* @returns {*}
|
|
17
17
|
*/
|
|
18
18
|
function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
19
|
-
let
|
|
20
|
-
const walk = (arr, parent) => {
|
|
19
|
+
let isBreak = false;
|
|
20
|
+
const walk = (arr, parent, level = 0) => {
|
|
21
21
|
if (isReverse) {
|
|
22
22
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
23
23
|
if (isBreak) {
|
|
@@ -33,9 +33,8 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
33
33
|
}
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
36
|
-
++level;
|
|
37
36
|
// @ts-ignore
|
|
38
|
-
walk(arr[i][children], arr[i]);
|
|
37
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -54,9 +53,8 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
54
53
|
}
|
|
55
54
|
// @ts-ignore
|
|
56
55
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
57
|
-
++level;
|
|
58
56
|
// @ts-ignore
|
|
59
|
-
walk(arr[i][children], arr[i]);
|
|
57
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
}
|
package/lib/es/tree.js
CHANGED
|
@@ -14,8 +14,8 @@ const defaultFieldOptions = { keyField: 'key', childField: 'children', pidField:
|
|
|
14
14
|
* @returns {*}
|
|
15
15
|
*/
|
|
16
16
|
function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
17
|
-
let
|
|
18
|
-
const walk = (arr, parent) => {
|
|
17
|
+
let isBreak = false;
|
|
18
|
+
const walk = (arr, parent, level = 0) => {
|
|
19
19
|
if (isReverse) {
|
|
20
20
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
21
21
|
if (isBreak) {
|
|
@@ -31,9 +31,8 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
31
31
|
}
|
|
32
32
|
// @ts-ignore
|
|
33
33
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
34
|
-
++level;
|
|
35
34
|
// @ts-ignore
|
|
36
|
-
walk(arr[i][children], arr[i]);
|
|
35
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
}
|
|
@@ -52,9 +51,8 @@ function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
52
51
|
}
|
|
53
52
|
// @ts-ignore
|
|
54
53
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
55
|
-
++level;
|
|
56
54
|
// @ts-ignore
|
|
57
|
-
walk(arr[i][children], arr[i]);
|
|
55
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
}
|
package/lib/umd/index.js
CHANGED
|
@@ -2052,8 +2052,8 @@
|
|
|
2052
2052
|
* @returns {*}
|
|
2053
2053
|
*/
|
|
2054
2054
|
function forEachDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
2055
|
-
let
|
|
2056
|
-
const walk = (arr, parent) => {
|
|
2055
|
+
let isBreak = false;
|
|
2056
|
+
const walk = (arr, parent, level = 0) => {
|
|
2057
2057
|
if (isReverse) {
|
|
2058
2058
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
2059
2059
|
if (isBreak) {
|
|
@@ -2069,9 +2069,8 @@
|
|
|
2069
2069
|
}
|
|
2070
2070
|
// @ts-ignore
|
|
2071
2071
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
2072
|
-
++level;
|
|
2073
2072
|
// @ts-ignore
|
|
2074
|
-
walk(arr[i][children], arr[i]);
|
|
2073
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
2075
2074
|
}
|
|
2076
2075
|
}
|
|
2077
2076
|
}
|
|
@@ -2090,9 +2089,8 @@
|
|
|
2090
2089
|
}
|
|
2091
2090
|
// @ts-ignore
|
|
2092
2091
|
if (arr[i] && Array.isArray(arr[i][children])) {
|
|
2093
|
-
++level;
|
|
2094
2092
|
// @ts-ignore
|
|
2095
|
-
walk(arr[i][children], arr[i]);
|
|
2093
|
+
walk(arr[i][children], arr[i], level + 1);
|
|
2096
2094
|
}
|
|
2097
2095
|
}
|
|
2098
2096
|
}
|