* Parse a string containing both the binding key and the path to the deeply * nested property to retrieve. * * @param keyWithPath - The key with an optional path, * e.g. "application.instance" or "config#rest.port".
(keyWithPath: BindingAddress<T>)
| 88 | * e.g. "application.instance" or "config#rest.port". |
| 89 | */ |
| 90 | static parseKeyWithPath<T>(keyWithPath: BindingAddress<T>): BindingKey<T> { |
| 91 | if (typeof keyWithPath !== 'string') { |
| 92 | return BindingKey.create<T>(keyWithPath.key, keyWithPath.propertyPath); |
| 93 | } |
| 94 | |
| 95 | const index = keyWithPath.indexOf(BindingKey.PROPERTY_SEPARATOR); |
| 96 | if (index === -1) { |
| 97 | return new BindingKey<T>(keyWithPath); |
| 98 | } |
| 99 | |
| 100 | return BindingKey.create<T>( |
| 101 | keyWithPath.slice(0, index).trim(), |
| 102 | keyWithPath.slice(index + 1), |
| 103 | ); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Name space for configuration binding keys |
no test coverage detected