* Generates columns' translation cache. * * @param {object} schema An object to generate schema from. * @param {number} lastCol The column index. * @param {number} parent The property cache for recursive calls. * @returns {number}
(schema: unknown, lastCol?: number, parent?: string)
| 234 | * @returns {number} |
| 235 | */ |
| 236 | recursiveDuckColumns(schema: unknown, lastCol?: number, parent?: string) { |
| 237 | let lastColumn: number = lastCol ?? 0; |
| 238 | const propertyParent: string = parent ?? ''; |
| 239 | let prop; |
| 240 | |
| 241 | if (typeof schema === 'object' && schema !== null && !Array.isArray(schema)) { |
| 242 | objectEach(schema, (value: unknown, key: string) => { |
| 243 | if (value === null) { |
| 244 | prop = propertyParent + key; |
| 245 | this.colToPropCache.push(prop); |
| 246 | this.propToColCache!.set(prop, lastColumn); |
| 247 | |
| 248 | lastColumn += 1; |
| 249 | } else if (typeof value === 'object' && value !== null) { |
| 250 | lastColumn = this.recursiveDuckColumns(value, lastColumn, `${key}.`); |
| 251 | } |
| 252 | }); |
| 253 | } |
| 254 | |
| 255 | return lastColumn; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Returns property name that corresponds with the given column index. |
no test coverage detected