mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-16 03:25:20 +08:00
DISABLE_THIRD_PARTY_CHECK=new npm module causes package-lock change We can get rid of a custom script and use ESLint for these rules. Additionally this means editors will highlight the issue in the editor. Change-Id: I552b52e7f07b4e7430b3f685dbc3b5fad36ffff2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052167 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
var _curry2 = /*#__PURE__*/require('./internal/_curry2');
|
|
|
|
/**
|
|
* Calls an input function `n` times, returning an array containing the results
|
|
* of those function calls.
|
|
*
|
|
* `fn` is passed one argument: The current value of `n`, which begins at `0`
|
|
* and is gradually incremented to `n - 1`.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.2.3
|
|
* @category List
|
|
* @sig (Number -> a) -> Number -> [a]
|
|
* @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
|
|
* @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
|
|
* @return {Array} An array containing the return values of all calls to `fn`.
|
|
* @see R.repeat
|
|
* @example
|
|
*
|
|
* R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
|
|
* @symb R.times(f, 0) = []
|
|
* @symb R.times(f, 1) = [f(0)]
|
|
* @symb R.times(f, 2) = [f(0), f(1)]
|
|
*/
|
|
|
|
|
|
var times = /*#__PURE__*/_curry2(function times(fn, n) {
|
|
var len = Number(n);
|
|
var idx = 0;
|
|
var list;
|
|
|
|
if (len < 0 || isNaN(len)) {
|
|
throw new RangeError('n must be a non-negative number');
|
|
}
|
|
list = new Array(len);
|
|
while (idx < len) {
|
|
list[idx] = fn(idx);
|
|
idx += 1;
|
|
}
|
|
return list;
|
|
});
|
|
module.exports = times; |