(
updatedPath: string,
strPath: string
)
| 21 | const previousHashes: Hashes = {}; |
| 22 | |
| 23 | const isFirstLevelPropsChild = ( |
| 24 | updatedPath: string, |
| 25 | strPath: string |
| 26 | ): [boolean, string[]] => { |
| 27 | const updatedSegments = updatedPath.split(','); |
| 28 | const fullSegments = strPath.split(','); |
| 29 | |
| 30 | // Check that strPath actually starts with updatedPath |
| 31 | const startsWithPath = fullSegments.every( |
| 32 | (seg, i) => updatedSegments[i] === seg |
| 33 | ); |
| 34 | |
| 35 | if (!startsWithPath) return [false, []]; |
| 36 | |
| 37 | // Get the remaining path after the prefix |
| 38 | const remainingSegments = updatedSegments.slice(fullSegments.length); |
| 39 | |
| 40 | const propsCount = remainingSegments.filter(s => s === 'props').length; |
| 41 | |
| 42 | return [propsCount < 2, remainingSegments]; |
| 43 | }; |
| 44 | |
| 45 | function determineChangedProps( |
| 46 | state: any, |
no test coverage detected
searching dependent graphs…