Skip to content

Commit 4827cd2

Browse files
committed
fix: node path parsing does not consider special characters.
1 parent b6e0f89 commit 4827cd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function jsonFlatten(
3333
keys.map((objKey, idx, arr) =>
3434
jsonFlatten(
3535
data[objKey],
36-
objKey.includes('.') ? `${path}["${objKey}"]` : `${path}.${objKey}`,
36+
/^[a-zA-Z_]\w*$/.test(objKey) ? `${path}.${objKey}` : `${path}["${objKey}"]`,
3737
level + 1,
3838
{
3939
key: objKey,

0 commit comments

Comments
 (0)