|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
792 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Converts a deep key string into an array of path segments.
|
|---|
| 3 | *
|
|---|
| 4 | * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.
|
|---|
| 5 | *
|
|---|
| 6 | * @param {any} deepKey - The deep key string to convert.
|
|---|
| 7 | * @returns {string[]} An array of strings, each representing a segment of the path.
|
|---|
| 8 | *
|
|---|
| 9 | * Examples:
|
|---|
| 10 | *
|
|---|
| 11 | * toPath('a.b.c') // Returns ['a', 'b', 'c']
|
|---|
| 12 | * toPath('a[b][c]') // Returns ['a', 'b', 'c']
|
|---|
| 13 | * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']
|
|---|
| 14 | * toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd']
|
|---|
| 15 | * toPath('') // Returns []
|
|---|
| 16 | * toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']
|
|---|
| 17 | */
|
|---|
| 18 | declare function toPath(deepKey: any): string[];
|
|---|
| 19 |
|
|---|
| 20 | export { toPath };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.