@spacet.me/chain
Version:
Like `_.chain` but only contains `thru` and `value` methods. Comes with TypeScript typings.
47 lines (43 loc) • 1.18 kB
TypeScript
/**
* This package implements a subset of Lodash’s `_.chain()`,
* containing just the {@link https://lodash.com/docs/4.17.11#thru | thru}
* and {@link https://lodash.com/docs/4.17.11#prototype-value | value} methods.
* To use this package, look at the {@link chain} function.
*
* @packageDocumentation
*/
/**
* A Chain object, created through the {@link chain} function.
* @public
*/
export declare class Chain<T> {
private __wrapped__;
/**
* @internal
*/
constructor(__wrapped__: T);
/**
* Apply a function to the value of the chain.
*/
thru<U>(interceptor: (value: T) => U): Chain<U>;
/**
* Returns the value of the chain.
*/
value(): T;
/**
* Returns the value of the chain, for seamless usage with `JSON.stringify()`.
*/
toJSON(): T;
/**
* Returns the value of the chain, for seamless usage comparison operators.
*/
valueOf(): T;
}
/**
* Creates a {@link Chain} object.
* @param value - The value to wrap.
* @returns A {@link Chain} object.
* @public
*/
export declare function chain<T>(value: T): Chain<T>;
export { }