(value: string, separator = ',')
| 1 | export function splitBy(value: string, separator = ',') { |
| 2 | const result: any[] = [] |
| 3 | let current = '' |
| 4 | let depth = 0 |
| 5 | for (let i = 0; i < value.length; i++) { |
| 6 | const char = value[i] |
| 7 | if (char === '(') { |
| 8 | depth++ |
| 9 | } else if (char === ')') { |
| 10 | depth-- |
| 11 | } else if (char === separator && depth === 0) { |
| 12 | result.push(current) |
| 13 | current = '' |
| 14 | continue |
| 15 | } |
| 16 | current += char |
| 17 | } |
| 18 | result.push(current) |
| 19 | return result |
| 20 | } |
| 21 | |
| 22 | export function splitDotPath(path: string): string[] { |
| 23 | return path.split('.').reduce((acc, curr) => { |
nothing calls this directly
no outgoing calls
no test coverage detected