main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
705 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _curry1 from "./internal/_curry1.js";
|
---|
| 2 | /**
|
---|
| 3 | * Returns a function that always returns the given value. Note that for
|
---|
| 4 | * non-primitives the value returned is a reference to the original value.
|
---|
| 5 | *
|
---|
| 6 | * This function is known as `const`, `constant`, or `K` (for K combinator) in
|
---|
| 7 | * other languages and libraries.
|
---|
| 8 | *
|
---|
| 9 | * @func
|
---|
| 10 | * @memberOf R
|
---|
| 11 | * @since v0.1.0
|
---|
| 12 | * @category Function
|
---|
| 13 | * @sig a -> (* -> a)
|
---|
| 14 | * @param {*} val The value to wrap in a function
|
---|
| 15 | * @return {Function} A Function :: * -> val.
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * const t = R.always('Tee');
|
---|
| 19 | * t(); //=> 'Tee'
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | var always =
|
---|
| 23 | /*#__PURE__*/
|
---|
| 24 | _curry1(function always(val) {
|
---|
| 25 | return function () {
|
---|
| 26 | return val;
|
---|
| 27 | };
|
---|
| 28 | });
|
---|
| 29 |
|
---|
| 30 | export default always; |
---|
Note:
See
TracBrowser
for help on using the repository browser.