mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 21:54:47 +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>
49 lines
2.0 KiB
JavaScript
49 lines
2.0 KiB
JavaScript
import _clone from './internal/_clone.js';
|
|
import _curry3 from './internal/_curry3.js';
|
|
import _isTransformer from './internal/_isTransformer.js';
|
|
import _reduce from './internal/_reduce.js';
|
|
import _stepCat from './internal/_stepCat.js';
|
|
|
|
/**
|
|
* Transforms the items of the list with the transducer and appends the
|
|
* transformed items to the accumulator using an appropriate iterator function
|
|
* based on the accumulator type.
|
|
*
|
|
* The accumulator can be an array, string, object or a transformer. Iterated
|
|
* items will be appended to arrays and concatenated to strings. Objects will
|
|
* be merged directly or 2-item arrays will be merged as key, value pairs.
|
|
*
|
|
* The accumulator can also be a transformer object that provides a 2-arity
|
|
* reducing iterator function, step, 0-arity initial value function, init, and
|
|
* 1-arity result extraction function result. The step function is used as the
|
|
* iterator function in reduce. The result function is used to convert the
|
|
* final accumulator into the return type and in most cases is R.identity. The
|
|
* init function is used to provide the initial accumulator.
|
|
*
|
|
* The iteration is performed with [`R.reduce`](#reduce) after initializing the
|
|
* transducer.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.12.0
|
|
* @category List
|
|
* @sig a -> (b -> b) -> [c] -> a
|
|
* @param {*} acc The initial accumulator value.
|
|
* @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
|
|
* @param {Array} list The list to iterate over.
|
|
* @return {*} The final, accumulated value.
|
|
* @see R.transduce
|
|
* @example
|
|
*
|
|
* const numbers = [1, 2, 3, 4];
|
|
* const transducer = R.compose(R.map(R.add(1)), R.take(2));
|
|
*
|
|
* R.into([], transducer, numbers); //=> [2, 3]
|
|
*
|
|
* const intoArray = R.into([]);
|
|
* intoArray(transducer, numbers); //=> [2, 3]
|
|
*/
|
|
var into = /*#__PURE__*/_curry3(function into(acc, xf, list) {
|
|
return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list);
|
|
});
|
|
export default into; |