* Check if the property want to access an Array * @param property
(property?: string)
| 29 | * @param property |
| 30 | */ |
| 31 | public static processArray(property?: string): ArrayInfo | null { |
| 32 | if (typeof property === 'undefined') { |
| 33 | return null |
| 34 | } |
| 35 | |
| 36 | if (regexCache[property]) { |
| 37 | return regexCache[property] |
| 38 | } |
| 39 | |
| 40 | const arrayIndexRegex = arrayRegex() |
| 41 | const match = arrayIndexRegex.exec(property.trim()) |
| 42 | if (match != null) { |
| 43 | const propertyName = match[1] |
| 44 | // reset the match[2] to the full array index. |
| 45 | const nestedArrayMatches = '[' + match[2].toString() + ']' |
| 46 | const nestedArrayIndicies = getArrayIndicies(nestedArrayMatches) |
| 47 | validateArrayIndicies(nestedArrayIndicies) |
| 48 | return (regexCache[property] = new ArrayInfo( |
| 49 | propertyName, |
| 50 | nestedArrayIndicies |
| 51 | )) |
| 52 | } |
| 53 | |
| 54 | return null |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Get the index for the array |
no test coverage detected