| 1 |
import { type FactoryArg, type FactoryReturnMasked } from './factory'; |
| 2 |
/** Mask pipe source and destination types */ |
| 3 |
export declare const PIPE_TYPE: { |
| 4 |
readonly MASKED: "value"; |
| 5 |
readonly UNMASKED: "unmaskedValue"; |
| 6 |
readonly TYPED: "typedValue"; |
| 7 |
}; |
| 8 |
type ValueOf<T> = T[keyof T]; |
| 9 |
type TypedValueOf<Opts extends FactoryArg, Type extends ValueOf<typeof PIPE_TYPE>> = Type extends (typeof PIPE_TYPE.MASKED | typeof PIPE_TYPE.UNMASKED) ? string : FactoryReturnMasked<Opts>['typedValue']; |
| 10 |
/** Creates new pipe function depending on mask type, source and destination options */ |
| 11 |
export declare function createPipe<Arg extends FactoryArg, From extends ValueOf<typeof PIPE_TYPE> = typeof PIPE_TYPE.MASKED, To extends ValueOf<typeof PIPE_TYPE> = typeof PIPE_TYPE.MASKED>(arg: Arg, from?: From, to?: To): (value: TypedValueOf<Arg, From>) => TypedValueOf<Arg, To>; |
| 12 |
/** Pipes value through mask depending on mask type, source and destination options */ |
| 13 |
export declare function pipe<Arg extends FactoryArg, From extends ValueOf<typeof PIPE_TYPE> = typeof PIPE_TYPE.MASKED, To extends ValueOf<typeof PIPE_TYPE> = typeof PIPE_TYPE.MASKED>(value: TypedValueOf<Arg, From>, mask: Arg, from?: From, to?: To): TypedValueOf<Arg, To>; |
| 14 |
export {}; |
| 15 |
//# sourceMappingURL=pipe.d.ts.map |