update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
964 changed files with 104265 additions and 16 deletions
37
node_modules/ramda/src/until.js
generated
vendored
Normal file
37
node_modules/ramda/src/until.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
var _curry3 =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_curry3");
|
||||
/**
|
||||
* Takes a predicate, a transformation function, and an initial value,
|
||||
* and returns a value of the same type as the initial value.
|
||||
* It does so by applying the transformation until the predicate is satisfied,
|
||||
* at which point it returns the satisfactory value.
|
||||
*
|
||||
* @func
|
||||
* @memberOf R
|
||||
* @since v0.20.0
|
||||
* @category Logic
|
||||
* @sig (a -> Boolean) -> (a -> a) -> a -> a
|
||||
* @param {Function} pred A predicate function
|
||||
* @param {Function} fn The iterator function
|
||||
* @param {*} init Initial value
|
||||
* @return {*} Final value that satisfies predicate
|
||||
* @example
|
||||
*
|
||||
* R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128
|
||||
*/
|
||||
|
||||
|
||||
var until =
|
||||
/*#__PURE__*/
|
||||
_curry3(function until(pred, fn, init) {
|
||||
var val = init;
|
||||
|
||||
while (!pred(val)) {
|
||||
val = fn(val);
|
||||
}
|
||||
|
||||
return val;
|
||||
});
|
||||
|
||||
module.exports = until;
|
Loading…
Add table
Add a link
Reference in a new issue