{"version":3,"file":"constant.js","names":[],"sources":["../src/constant.ts"],"sourcesContent":["/**\n * A function that takes any arguments and returns the provided `value` on every\n * invocation. This is useful to provide trivial implementations for APIs or in\n * combination with a ternary or other conditional execution to allow to short-\n * circuit more complex implementations for a specific case.\n *\n * Notice that this is a dataLast impl where the function needs to be invoked\n * to get the \"do nothing\" function.\n *\n * See also:\n * `doNothing` - A function that doesn't return anything.\n * `identity` - A function that returns the first argument it receives.\n *\n * @param value - The constant value that would be returned on every invocation.\n * The value is not copied/cloned on every invocation so care should be taken\n * with mutable objects (like arrays, objects, Maps, etc...).\n * @signature\n *   constant(value);\n * @example\n *   map([1, 2, 3], constant('a')); // => ['a', 'a', 'a']\n *   map(\n *     [1, 2, 3],\n *     isDemoMode ? add(1) : constant(0),\n *   ); // => [2, 3, 4] or [0, 0, 0]\n * @dataLast\n * @category Function\n */\nexport function constant<const T>(\n  value: T,\n): // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- There is no other way to make typescript infer the function arguments \"backwards\" in data-last invocations without the Args type parameter. @see: https://github.com/typescript-eslint/typescript-eslint/issues/9887\n<Args extends readonly unknown[]>(...args: Args) => T {\n  return () => value;\n}\n"],"mappings":"AA2BA,SAAgB,EACd,EAEoD,CACpD,UAAa"}