|
1 | | -// Ramda v0.24.0 |
| 1 | +// Ramda v0.24.1 |
2 | 2 | // https://github.com/ramda/ramda |
3 | 3 | // (c) 2013-2017 Scott Sauyet, Michael Hurley, and David Chambers |
4 | 4 | // Ramda may be freely distributed under the MIT license. |
|
559 | 559 | }; |
560 | 560 | }; |
561 | 561 |
|
| 562 | + /** |
| 563 | + * Tests whether or not an object is similar to an array. |
| 564 | + * |
| 565 | + * @private |
| 566 | + * @category Type |
| 567 | + * @category List |
| 568 | + * @sig * -> Boolean |
| 569 | + * @param {*} x The object to test. |
| 570 | + * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise. |
| 571 | + * @example |
| 572 | + * |
| 573 | + * _isArrayLike([]); //=> true |
| 574 | + * _isArrayLike(true); //=> false |
| 575 | + * _isArrayLike({}); //=> false |
| 576 | + * _isArrayLike({length: 10}); //=> false |
| 577 | + * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true |
| 578 | + */ |
562 | 579 | var _isArrayLike = _curry1(function isArrayLike(x) { |
563 | 580 | if (_isArray(x)) { |
564 | 581 | return true; |
|
6801 | 6818 | * @memberOf R |
6802 | 6819 | * @since v0.12.0 |
6803 | 6820 | * @category List |
6804 | | - * @sig (c -> c) -> (a,b -> a) -> a -> [b] -> a |
| 6821 | + * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a |
6805 | 6822 | * @param {Function} xf The transducer function. Receives a transformer and returns a transformer. |
6806 | 6823 | * @param {Function} fn The iterator function. Receives two values, the accumulator and the |
6807 | 6824 | * current element from the array. Wrapped as transformer, if necessary, and used to |
|
6814 | 6831 | * |
6815 | 6832 | * var numbers = [1, 2, 3, 4]; |
6816 | 6833 | * var transducer = R.compose(R.map(R.add(1)), R.take(2)); |
6817 | | - * |
6818 | 6834 | * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] |
| 6835 | + * |
| 6836 | + * var isOdd = (x) => x % 2 === 1; |
| 6837 | + * var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); |
| 6838 | + * R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] |
6819 | 6839 | */ |
6820 | 6840 | var transduce = curryN(4, function transduce(xf, fn, acc, list) { |
6821 | 6841 | return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list); |
|
8882 | 8902 | * factorial(5); //=> 120 |
8883 | 8903 | * count; //=> 1 |
8884 | 8904 | */ |
8885 | | - var memoize = memoizeWith(toString); |
| 8905 | + var memoize = memoizeWith(function () { |
| 8906 | + return toString(arguments); |
| 8907 | + }); |
8886 | 8908 |
|
8887 | 8909 | /** |
8888 | 8910 | * Splits a string into an array of strings based on the given |
|
0 commit comments