UNPKG

dino-core

Version:

A dependency injection framework for NodeJS applications

35 lines (34 loc) 885 B
/** * Implements the Optional patters * @public * @class */ export declare class Optional<T> { private readonly value; /** * Create a new instance of optional * @param value the value set as optional * @private */ constructor(value: T); /** * Allows to access this optional value * @returns this optional value * @public */ get(): T; /** * Validate is this optional value is present * @returns true if this optional contains a not null and not undefined value, false otherwise * @public */ isPresent(): boolean; /** * Create an optional starting from the provided value. * @param value the value to set on this optional. The value can be undefined or null * @returns a new Optional instance * @public * @static */ static from<T>(value: T): Optional<T>; }