mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 11:31:31 +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>
44 lines
1.8 KiB
JavaScript
44 lines
1.8 KiB
JavaScript
import _curry2 from './internal/_curry2.js';
|
|
import curryN from './curryN.js';
|
|
|
|
/**
|
|
* Accepts a function `fn` and a list of transformer functions and returns a
|
|
* new curried function. When the new function is invoked, it calls the
|
|
* function `fn` with parameters consisting of the result of calling each
|
|
* supplied handler on successive arguments to the new function.
|
|
*
|
|
* If more arguments are passed to the returned function than transformer
|
|
* functions, those arguments are passed directly to `fn` as additional
|
|
* parameters. If you expect additional arguments that don't need to be
|
|
* transformed, although you can ignore them, it's best to pass an identity
|
|
* function so that the new function reports the correct arity.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category Function
|
|
* @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z)
|
|
* @param {Function} fn The function to wrap.
|
|
* @param {Array} transformers A list of transformer functions
|
|
* @return {Function} The wrapped function.
|
|
* @see R.converge
|
|
* @example
|
|
*
|
|
* R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81
|
|
* R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81
|
|
* R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32
|
|
* R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32
|
|
* @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b))
|
|
*/
|
|
var useWith = /*#__PURE__*/_curry2(function useWith(fn, transformers) {
|
|
return curryN(transformers.length, function () {
|
|
var args = [];
|
|
var idx = 0;
|
|
while (idx < transformers.length) {
|
|
args.push(transformers[idx].call(this, arguments[idx]));
|
|
idx += 1;
|
|
}
|
|
return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length)));
|
|
});
|
|
});
|
|
export default useWith; |