* Create a new key for a binding bound to a value of type `ValueType`. * * @example * * ```ts * BindingKey.create ('application.name'); * BindingKey.create ('config', 'rest.port); * BindingKey.create ('config#rest.port'); * ``` * * @param key - The
(key: string, propertyPath?: string)
| 27 | * @param propertyPath - Optional path to a deep property of the bound value. |
| 28 | */ |
| 29 | public static create<V>(key: string, propertyPath?: string): BindingKey<V> { |
| 30 | // TODO(bajtos) allow chaining of propertyPaths, e.g. |
| 31 | // BindingKey.create('config#rest', 'port') |
| 32 | // should create {key: 'config', path: 'rest.port'} |
| 33 | if (propertyPath) { |
| 34 | BindingKey.validate(key); |
| 35 | return new BindingKey<V>(key, propertyPath); |
| 36 | } |
| 37 | |
| 38 | return BindingKey.parseKeyWithPath(key); |
| 39 | } |
| 40 | |
| 41 | private constructor( |
| 42 | public readonly key: string, |
nothing calls this directly
no test coverage detected