UNPKG

@typescript-package/data

Version:

A lightweight TypeScript library for basic data management.

51 lines (50 loc) 1.5 kB
import { DataCore } from './data-core.abstract'; /** * @description The `Data` class is a concrete class that wraps a value and provides methods for setting, retrieving, and destroying the value. * @export * @class Data * @template Type * @extends {DataCore<Type>} */ export declare class Data<Type> extends DataCore<Type> { #private; /** * @description Returns the `string` tag representation of the `Data` class when used in `Object.prototype.toString.call(instance)`. * @public * @readonly * @type {string} */ get [Symbol.toStringTag](): string; /** * @description Returns the privately stored value of generic type variable `Type`. * @public * @readonly * @type {Type} */ get value(): Type; /** * Creates an instance of `Data`. * @constructor * @param {Type} value Initial data value of generic type variable `Type`. */ constructor(value: Type); /** * @description Clears the value to `null`. * @public * @returns {this} The `this` current instance. */ clear(): this; /** * @description Destroys the `Value` object by setting it to `null`. * @public * @returns {this} The `this` current instance. */ destroy(): this; /** * @description Sets the data value. * @public * @param {Type} value The data value of `Type` to set. * @returns {this} The `this` current instance. */ set(value: Type): this; }