UNPKG

@donation-alerts/common

Version:

Common utils and types that are used in other @donation-alerts packages.

32 lines 1.07 kB
/** @internal */ export declare const rawDataSymbol: unique symbol; /** * Retrieves a deep clone of the raw data of the given `DataObject` instance. * * @param data The `DataObject` instance from which to obtain the raw data. * * @returns A deep-cloned copy of the raw data stored within the given data object. * * @example * ```ts * const rawData = getRawData(myDataObject); * console.log(rawData); // Logs the raw data * ``` */ export declare function getRawData<T>(data: DataObject<T>): T; /** @internal */ export declare abstract class DataObject<T, J extends object = object> { /** @internal */ readonly [rawDataSymbol]: T; /** @internal */ constructor(data: T); /** * Serializes the instance into a plain JavaScript object. * * This method is automatically invoked when the instance is passed to `JSON.stringify()`. * * In Node.js, it's also used when the instance is logged via `console.log()` (via the `util.inspect` mechanism). */ abstract toJSON(): J; } //# sourceMappingURL=data-object.d.ts.map