es-toolkit 1.23.0-dev.742 → 1.23.0-dev.743

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -201,6 +201,7 @@ export { round } from './math/round.mjs';
201
201
  export { parseInt } from './math/parseInt.mjs';
202
202
  export { inRange } from './math/inRange.mjs';
203
203
  export { random } from './math/random.mjs';
204
+ export { constant } from './util/constant.mjs';
204
205
  export { toPath } from './util/toPath.mjs';
205
206
  export { toString } from './util/toString.mjs';
206
207
  export { toNumber } from './util/toNumber.mjs';
@@ -201,6 +201,7 @@ export { round } from './math/round.js';
201
201
  export { parseInt } from './math/parseInt.js';
202
202
  export { inRange } from './math/inRange.js';
203
203
  export { random } from './math/random.js';
204
+ export { constant } from './util/constant.js';
204
205
  export { toPath } from './util/toPath.js';
205
206
  export { toString } from './util/toString.js';
206
207
  export { toNumber } from './util/toNumber.js';
@@ -1969,6 +1969,10 @@ function random(...args) {
1969
1969
  }
1970
1970
  }
1971
1971
 
1972
+ function constant(value) {
1973
+ return () => value;
1974
+ }
1975
+
1972
1976
  exports.at = zipWith.at;
1973
1977
  exports.compact = zipWith.compact;
1974
1978
  exports.countBy = zipWith.countBy;
@@ -2079,6 +2083,7 @@ exports.cloneDeep = cloneDeep;
2079
2083
  exports.concat = concat;
2080
2084
  exports.conforms = conforms;
2081
2085
  exports.conformsTo = conformsTo;
2086
+ exports.constant = constant;
2082
2087
  exports.curry = curry;
2083
2088
  exports.curryRight = curryRight;
2084
2089
  exports.debounce = debounce;
@@ -202,6 +202,7 @@ export { round } from './math/round.mjs';
202
202
  export { parseInt } from './math/parseInt.mjs';
203
203
  export { inRange } from './math/inRange.mjs';
204
204
  export { random } from './math/random.mjs';
205
+ export { constant } from './util/constant.mjs';
205
206
  export { toPath } from './util/toPath.mjs';
206
207
  export { toString } from './util/toString.mjs';
207
208
  export { toNumber } from './util/toNumber.mjs';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Creates a new function that always returns `undefined`.
3
+ *
4
+ * @returns {() => undefined} Returns the new constant function.
5
+ */
6
+ declare function constant(): () => undefined;
7
+ /**
8
+ * Creates a new function that always returns `value`.
9
+ *
10
+ * @template T - The type of the value to return.
11
+ * @param {T} value - The value to return from the new function.
12
+ * @returns {() => T} Returns the new constant function.
13
+ */
14
+ declare function constant<T>(value: T): () => T;
15
+
16
+ export { constant };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Creates a new function that always returns `undefined`.
3
+ *
4
+ * @returns {() => undefined} Returns the new constant function.
5
+ */
6
+ declare function constant(): () => undefined;
7
+ /**
8
+ * Creates a new function that always returns `value`.
9
+ *
10
+ * @template T - The type of the value to return.
11
+ * @param {T} value - The value to return from the new function.
12
+ * @returns {() => T} Returns the new constant function.
13
+ */
14
+ declare function constant<T>(value: T): () => T;
15
+
16
+ export { constant };
@@ -0,0 +1,5 @@
1
+ function constant(value) {
2
+ return () => value;
3
+ }
4
+
5
+ export { constant };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.23.0-dev.742+b739a275",
4
+ "version": "1.23.0-dev.743+42a4b942",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {