Skip to content

Commit 7e866ce

Browse files
committed
fix: No flat, for compatibility. #117
1 parent 81ca6d4 commit 7e866ce

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/utils/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
// 获取数据类型
21
export function getDataType(value) {
3-
return Object.prototype.toString
4-
.call(value)
5-
.slice(8, -1)
6-
.toLowerCase();
2+
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
73
}
84

95
// type enum: content | objectStart | objectEnd | objectCollapsed | arrayStart | arrayEnd | arrayCollapsed
@@ -24,7 +20,8 @@ export function jsonFlatten(
2420
type,
2521
}),
2622
)
27-
.flat();
23+
// No flat, for compatibility.
24+
.reduce((acc, val) => acc.concat(val), []);
2825
return [
2926
jsonFlatten('[', path, level, { key, length: data.length, type: 'arrayStart' })[0],
3027
].concat(
@@ -47,7 +44,8 @@ export function jsonFlatten(
4744
},
4845
),
4946
)
50-
.flat();
47+
// No flat, for compatibility.
48+
.reduce((acc, val) => acc.concat(val), []);
5149
return [
5250
jsonFlatten('{', path, level, { key, index, length: keys.length, type: 'objectStart' })[0],
5351
].concat(

0 commit comments

Comments
 (0)