UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

1 lines 1.07 kB
{"version":3,"file":"utilityEvaluators-Cn_nNk4V.cjs","names":[],"sources":["../src/internal/utilityEvaluators.ts"],"sourcesContent":["import type { LazyResult } from \"./types/LazyResult\";\n\nconst EMPTY_PIPE = { done: true, hasNext: false } as const;\n\n/**\n * A singleton value for skipping an item in a lazy evaluator.\n */\nexport const SKIP_ITEM = { done: false, hasNext: false } as const;\n\n/**\n * A helper evaluator when we want to return an empty result. It memoizes both\n * the result and the evaluator itself to reduce memory usage.\n */\nexport const lazyEmptyEvaluator = <T>(): LazyResult<T> => EMPTY_PIPE;\n\n/**\n * A helper evaluator when we want to return a shallow clone of the input. It\n * memoizes both the evaluator itself to reduce memory usage.\n */\nexport const lazyIdentityEvaluator = <T>(value: T) =>\n ({\n hasNext: true,\n next: value,\n done: false,\n }) as const;\n"],"mappings":"AAEA,MAAM,EAAa,CAAE,KAAM,GAAM,QAAS,EAAM,EAKnC,EAAY,CAAE,KAAM,GAAO,QAAS,EAAM,EAM1C,MAA6C,EAM7C,EAA4B,IACtC,CACC,QAAS,GACT,KAAM,EACN,KAAM,EACR"}