You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
386 B
13 lines
386 B
import {Canonical} from './Canonical.ts'
|
|
|
|
export class RecursiveCanonical extends Canonical<any> {
|
|
public get(key: string, fallback?: any): any | undefined {
|
|
const parts = key.split('.')
|
|
let current_value = this._items
|
|
for ( const part of parts ) {
|
|
current_value = current_value?.[part]
|
|
}
|
|
return current_value ?? fallback
|
|
}
|
|
}
|