(instance: any, dataPath: string)
| 43 | }; |
| 44 | |
| 45 | export const resolveData = (instance: any, dataPath: string): any => { |
| 46 | if (isEmpty(dataPath)) { |
| 47 | return instance; |
| 48 | } |
| 49 | const dataPathSegments = dataPath.split('.'); |
| 50 | |
| 51 | return dataPathSegments.reduce((curInstance, decodedSegment) => { |
| 52 | if ( |
| 53 | !curInstance || |
| 54 | !Object.prototype.hasOwnProperty.call(curInstance, decodedSegment) |
| 55 | ) { |
| 56 | return undefined; |
| 57 | } |
| 58 | |
| 59 | return curInstance[decodedSegment]; |
| 60 | }, instance); |
| 61 | }; |
| 62 | |
| 63 | /** |
| 64 | * Finds all references inside the given schema. |
no outgoing calls
no test coverage detected
searching dependent graphs…