@bigbinary/neetoui 5.0.7 → 5.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/formik.js CHANGED
@@ -441,224 +441,56 @@ var _xfBase = {
441
441
  }
442
442
  };
443
443
 
444
- function _map(fn, functor) {
445
- var idx = 0;
446
- var len = functor.length;
447
- var result = Array(len);
448
-
449
- while (idx < len) {
450
- result[idx] = fn(functor[idx]);
451
- idx += 1;
452
- }
453
-
454
- return result;
455
- }
456
-
457
- function _isString(x) {
458
- return Object.prototype.toString.call(x) === '[object String]';
459
- }
460
-
461
- /**
462
- * Tests whether or not an object is similar to an array.
463
- *
464
- * @private
465
- * @category Type
466
- * @category List
467
- * @sig * -> Boolean
468
- * @param {*} x The object to test.
469
- * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
470
- * @example
471
- *
472
- * _isArrayLike([]); //=> true
473
- * _isArrayLike(true); //=> false
474
- * _isArrayLike({}); //=> false
475
- * _isArrayLike({length: 10}); //=> false
476
- * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
477
- * _isArrayLike({nodeType: 1, length: 1}) // => false
478
- */
479
-
480
- var _isArrayLike =
481
- /*#__PURE__*/
482
- _curry1(function isArrayLike(x) {
483
- if (_isArray(x)) {
484
- return true;
485
- }
486
-
487
- if (!x) {
488
- return false;
489
- }
490
-
491
- if (typeof x !== 'object') {
492
- return false;
493
- }
494
-
495
- if (_isString(x)) {
496
- return false;
497
- }
498
-
499
- if (x.length === 0) {
500
- return true;
501
- }
502
-
503
- if (x.length > 0) {
504
- return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
505
- }
506
-
507
- return false;
508
- });
444
+ function _arrayFromIterator(iter) {
445
+ var list = [];
446
+ var next;
509
447
 
510
- var XWrap =
511
- /*#__PURE__*/
512
- function () {
513
- function XWrap(fn) {
514
- this.f = fn;
448
+ while (!(next = iter.next()).done) {
449
+ list.push(next.value);
515
450
  }
516
451
 
517
- XWrap.prototype['@@transducer/init'] = function () {
518
- throw new Error('init not implemented on XWrap');
519
- };
520
-
521
- XWrap.prototype['@@transducer/result'] = function (acc) {
522
- return acc;
523
- };
524
-
525
- XWrap.prototype['@@transducer/step'] = function (acc, x) {
526
- return this.f(acc, x);
527
- };
528
-
529
- return XWrap;
530
- }();
531
-
532
- function _xwrap(fn) {
533
- return new XWrap(fn);
452
+ return list;
534
453
  }
535
454
 
536
- /**
537
- * Creates a function that is bound to a context.
538
- * Note: `R.bind` does not provide the additional argument-binding capabilities of
539
- * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
540
- *
541
- * @func
542
- * @memberOf R
543
- * @since v0.6.0
544
- * @category Function
545
- * @category Object
546
- * @sig (* -> *) -> {*} -> (* -> *)
547
- * @param {Function} fn The function to bind to context
548
- * @param {Object} thisObj The context to bind `fn` to
549
- * @return {Function} A function that will execute in the context of `thisObj`.
550
- * @see R.partial
551
- * @example
552
- *
553
- * const log = R.bind(console.log, console);
554
- * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
555
- * // logs {a: 2}
556
- * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
557
- */
558
-
559
- var bind =
560
- /*#__PURE__*/
561
- _curry2(function bind(fn, thisObj) {
562
- return _arity(fn.length, function () {
563
- return fn.apply(thisObj, arguments);
564
- });
565
- });
566
-
567
- function _arrayReduce(xf, acc, list) {
455
+ function _includesWith(pred, x, list) {
568
456
  var idx = 0;
569
457
  var len = list.length;
570
458
 
571
459
  while (idx < len) {
572
- acc = xf['@@transducer/step'](acc, list[idx]);
573
-
574
- if (acc && acc['@@transducer/reduced']) {
575
- acc = acc['@@transducer/value'];
576
- break;
460
+ if (pred(x, list[idx])) {
461
+ return true;
577
462
  }
578
463
 
579
464
  idx += 1;
580
465
  }
581
466
 
582
- return xf['@@transducer/result'](acc);
467
+ return false;
583
468
  }
584
469
 
585
- function _iterableReduce(xf, acc, iter) {
586
- var step = iter.next();
587
-
588
- while (!step.done) {
589
- acc = xf['@@transducer/step'](acc, step.value);
590
-
591
- if (acc && acc['@@transducer/reduced']) {
592
- acc = acc['@@transducer/value'];
593
- break;
594
- }
595
-
596
- step = iter.next();
597
- }
598
-
599
- return xf['@@transducer/result'](acc);
470
+ function _functionName(f) {
471
+ // String(x => x) evaluates to "x => x", so the pattern may not match.
472
+ var match = String(f).match(/^function (\w*)/);
473
+ return match == null ? '' : match[1];
600
474
  }
601
475
 
602
- function _methodReduce(xf, acc, obj, methodName) {
603
- return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
476
+ function _has(prop, obj) {
477
+ return Object.prototype.hasOwnProperty.call(obj, prop);
604
478
  }
605
479
 
606
- var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
607
- function _reduce(fn, acc, list) {
608
- if (typeof fn === 'function') {
609
- fn = _xwrap(fn);
610
- }
611
-
612
- if (_isArrayLike(list)) {
613
- return _arrayReduce(fn, acc, list);
614
- }
615
-
616
- if (typeof list['fantasy-land/reduce'] === 'function') {
617
- return _methodReduce(fn, acc, list, 'fantasy-land/reduce');
618
- }
619
-
620
- if (list[symIterator] != null) {
621
- return _iterableReduce(fn, acc, list[symIterator]());
622
- }
623
-
624
- if (typeof list.next === 'function') {
625
- return _iterableReduce(fn, acc, list);
626
- }
627
-
628
- if (typeof list.reduce === 'function') {
629
- return _methodReduce(fn, acc, list, 'reduce');
480
+ // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
481
+ function _objectIs(a, b) {
482
+ // SameValue algorithm
483
+ if (a === b) {
484
+ // Steps 1-5, 7-10
485
+ // Steps 6.b-6.e: +0 != -0
486
+ return a !== 0 || 1 / a === 1 / b;
487
+ } else {
488
+ // Step 6.a: NaN == NaN
489
+ return a !== a && b !== b;
630
490
  }
631
-
632
- throw new TypeError('reduce: list must be array or iterable');
633
491
  }
634
492
 
635
- var XMap =
636
- /*#__PURE__*/
637
- function () {
638
- function XMap(f, xf) {
639
- this.xf = xf;
640
- this.f = f;
641
- }
642
-
643
- XMap.prototype['@@transducer/init'] = _xfBase.init;
644
- XMap.prototype['@@transducer/result'] = _xfBase.result;
645
-
646
- XMap.prototype['@@transducer/step'] = function (result, input) {
647
- return this.xf['@@transducer/step'](result, this.f(input));
648
- };
649
-
650
- return XMap;
651
- }();
652
-
653
- var _xmap =
654
- /*#__PURE__*/
655
- _curry2(function _xmap(f, xf) {
656
- return new XMap(f, xf);
657
- });
658
-
659
- function _has(prop, obj) {
660
- return Object.prototype.hasOwnProperty.call(obj, prop);
661
- }
493
+ var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
662
494
 
663
495
  var toString = Object.prototype.toString;
664
496
 
@@ -759,668 +591,773 @@ _curry1(function keys(obj) {
759
591
  });
760
592
 
761
593
  /**
762
- * Takes a function and
763
- * a [functor](https://github.com/fantasyland/fantasy-land#functor),
764
- * applies the function to each of the functor's values, and returns
765
- * a functor of the same shape.
766
- *
767
- * Ramda provides suitable `map` implementations for `Array` and `Object`,
768
- * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
769
- *
770
- * Dispatches to the `map` method of the second argument, if present.
771
- *
772
- * Acts as a transducer if a transformer is given in list position.
773
- *
774
- * Also treats functions as functors and will compose them together.
594
+ * Gives a single-word string description of the (native) type of a value,
595
+ * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
596
+ * attempt to distinguish user Object types any further, reporting them all as
597
+ * 'Object'.
775
598
  *
776
599
  * @func
777
600
  * @memberOf R
778
- * @since v0.1.0
779
- * @category List
780
- * @sig Functor f => (a -> b) -> f a -> f b
781
- * @param {Function} fn The function to be called on every element of the input `list`.
782
- * @param {Array} list The list to be iterated over.
783
- * @return {Array} The new list.
784
- * @see R.transduce, R.addIndex, R.pluck, R.project
601
+ * @since v0.8.0
602
+ * @category Type
603
+ * @sig * -> String
604
+ * @param {*} val The value to test
605
+ * @return {String}
785
606
  * @example
786
607
  *
787
- * const double = x => x * 2;
788
- *
789
- * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
790
- *
791
- * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
792
- * @symb R.map(f, [a, b]) = [f(a), f(b)]
793
- * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
794
- * @symb R.map(f, functor_o) = functor_o.map(f)
608
+ * R.type({}); //=> "Object"
609
+ * R.type(1); //=> "Number"
610
+ * R.type(false); //=> "Boolean"
611
+ * R.type('s'); //=> "String"
612
+ * R.type(null); //=> "Null"
613
+ * R.type([]); //=> "Array"
614
+ * R.type(/[A-z]/); //=> "RegExp"
615
+ * R.type(() => {}); //=> "Function"
616
+ * R.type(undefined); //=> "Undefined"
795
617
  */
796
618
 
797
- var map =
798
- /*#__PURE__*/
799
- _curry2(
619
+ var type =
800
620
  /*#__PURE__*/
801
- _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
802
- switch (Object.prototype.toString.call(functor)) {
803
- case '[object Function]':
804
- return curryN(functor.length, function () {
805
- return fn.call(this, functor.apply(this, arguments));
806
- });
807
-
808
- case '[object Object]':
809
- return _reduce(function (acc, key) {
810
- acc[key] = fn(functor[key]);
811
- return acc;
812
- }, {}, keys(functor));
813
-
814
- default:
815
- return _map(fn, functor);
816
- }
817
- }));
621
+ _curry1(function type(val) {
622
+ return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
623
+ });
818
624
 
819
625
  /**
820
- * Determine if the passed argument is an integer.
626
+ * private _uniqContentEquals function.
627
+ * That function is checking equality of 2 iterator contents with 2 assumptions
628
+ * - iterators lengths are the same
629
+ * - iterators values are unique
821
630
  *
822
- * @private
823
- * @param {*} n
824
- * @category Type
825
- * @return {Boolean}
826
- */
827
- var _isInteger = Number.isInteger || function _isInteger(n) {
828
- return n << 0 === n;
829
- };
631
+ * false-positive result will be returned for comparison of, e.g.
632
+ * - [1,2,3] and [1,2,3,4]
633
+ * - [1,1,1] and [1,2,3]
634
+ * */
830
635
 
831
- /**
832
- * Returns the nth element of the given list or string. If n is negative the
833
- * element at index length + n is returned.
834
- *
835
- * @func
836
- * @memberOf R
837
- * @since v0.1.0
838
- * @category List
839
- * @sig Number -> [a] -> a | Undefined
840
- * @sig Number -> String -> String
841
- * @param {Number} offset
842
- * @param {*} list
843
- * @return {*}
844
- * @example
845
- *
846
- * const list = ['foo', 'bar', 'baz', 'quux'];
847
- * R.nth(1, list); //=> 'bar'
848
- * R.nth(-1, list); //=> 'quux'
849
- * R.nth(-99, list); //=> undefined
850
- *
851
- * R.nth(2, 'abc'); //=> 'c'
852
- * R.nth(3, 'abc'); //=> ''
853
- * @symb R.nth(-1, [a, b, c]) = c
854
- * @symb R.nth(0, [a, b, c]) = a
855
- * @symb R.nth(1, [a, b, c]) = b
856
- */
636
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
637
+ var a = _arrayFromIterator(aIterator);
857
638
 
858
- var nth =
859
- /*#__PURE__*/
860
- _curry2(function nth(offset, list) {
861
- var idx = offset < 0 ? list.length + offset : offset;
862
- return _isString(list) ? list.charAt(idx) : list[idx];
863
- });
639
+ var b = _arrayFromIterator(bIterator);
864
640
 
865
- /**
866
- * Returns a function that when supplied an object returns the indicated
867
- * property of that object, if it exists.
868
- *
869
- * @func
870
- * @memberOf R
871
- * @since v0.1.0
872
- * @category Object
873
- * @typedefn Idx = String | Int | Symbol
874
- * @sig Idx -> {s: a} -> a | Undefined
875
- * @param {String|Number} p The property name or array index
876
- * @param {Object} obj The object to query
877
- * @return {*} The value at `obj.p`.
878
- * @see R.path, R.props, R.pluck, R.project, R.nth
879
- * @example
880
- *
881
- * R.prop('x', {x: 100}); //=> 100
882
- * R.prop('x', {}); //=> undefined
883
- * R.prop(0, [100]); //=> 100
884
- * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
885
- */
641
+ function eq(_a, _b) {
642
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
643
+ } // if *a* array contains any element that is not included in *b*
886
644
 
887
- var prop =
888
- /*#__PURE__*/
889
- _curry2(function prop(p, obj) {
890
- if (obj == null) {
891
- return;
645
+
646
+ return !_includesWith(function (b, aItem) {
647
+ return !_includesWith(eq, aItem, b);
648
+ }, b, a);
649
+ }
650
+
651
+ function _equals(a, b, stackA, stackB) {
652
+ if (_objectIs$1(a, b)) {
653
+ return true;
892
654
  }
893
655
 
894
- return _isInteger(p) ? nth(p, obj) : obj[p];
895
- });
656
+ var typeA = type(a);
896
657
 
897
- /**
898
- * Returns a new list by plucking the same named property off all objects in
899
- * the list supplied.
900
- *
901
- * `pluck` will work on
902
- * any [functor](https://github.com/fantasyland/fantasy-land#functor) in
903
- * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`.
904
- *
905
- * @func
906
- * @memberOf R
907
- * @since v0.1.0
908
- * @category List
909
- * @sig Functor f => k -> f {k: v} -> f v
910
- * @param {Number|String} key The key name to pluck off of each object.
911
- * @param {Array} f The array or functor to consider.
912
- * @return {Array} The list of values for the given key.
913
- * @see R.project, R.prop, R.props
914
- * @example
915
- *
916
- * var getAges = R.pluck('age');
917
- * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
918
- *
919
- * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3]
920
- * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
921
- * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
922
- * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
923
- */
658
+ if (typeA !== type(b)) {
659
+ return false;
660
+ }
924
661
 
925
- var pluck =
926
- /*#__PURE__*/
927
- _curry2(function pluck(p, list) {
928
- return map(prop(p), list);
929
- });
662
+ if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
663
+ return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
664
+ }
665
+
666
+ if (typeof a.equals === 'function' || typeof b.equals === 'function') {
667
+ return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
668
+ }
669
+
670
+ switch (typeA) {
671
+ case 'Arguments':
672
+ case 'Array':
673
+ case 'Object':
674
+ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
675
+ return a === b;
676
+ }
677
+
678
+ break;
679
+
680
+ case 'Boolean':
681
+ case 'Number':
682
+ case 'String':
683
+ if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
684
+ return false;
685
+ }
686
+
687
+ break;
688
+
689
+ case 'Date':
690
+ if (!_objectIs$1(a.valueOf(), b.valueOf())) {
691
+ return false;
692
+ }
693
+
694
+ break;
695
+
696
+ case 'Error':
697
+ return a.name === b.name && a.message === b.message;
698
+
699
+ case 'RegExp':
700
+ if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
701
+ return false;
702
+ }
703
+
704
+ break;
705
+ }
706
+
707
+ var idx = stackA.length - 1;
708
+
709
+ while (idx >= 0) {
710
+ if (stackA[idx] === a) {
711
+ return stackB[idx] === b;
712
+ }
713
+
714
+ idx -= 1;
715
+ }
716
+
717
+ switch (typeA) {
718
+ case 'Map':
719
+ if (a.size !== b.size) {
720
+ return false;
721
+ }
722
+
723
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
724
+
725
+ case 'Set':
726
+ if (a.size !== b.size) {
727
+ return false;
728
+ }
729
+
730
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
731
+
732
+ case 'Arguments':
733
+ case 'Array':
734
+ case 'Object':
735
+ case 'Boolean':
736
+ case 'Number':
737
+ case 'String':
738
+ case 'Date':
739
+ case 'Error':
740
+ case 'RegExp':
741
+ case 'Int8Array':
742
+ case 'Uint8Array':
743
+ case 'Uint8ClampedArray':
744
+ case 'Int16Array':
745
+ case 'Uint16Array':
746
+ case 'Int32Array':
747
+ case 'Uint32Array':
748
+ case 'Float32Array':
749
+ case 'Float64Array':
750
+ case 'ArrayBuffer':
751
+ break;
752
+
753
+ default:
754
+ // Values of other types are only equal if identical.
755
+ return false;
756
+ }
757
+
758
+ var keysA = keys(a);
759
+
760
+ if (keysA.length !== keys(b).length) {
761
+ return false;
762
+ }
763
+
764
+ var extendedStackA = stackA.concat([a]);
765
+ var extendedStackB = stackB.concat([b]);
766
+ idx = keysA.length - 1;
767
+
768
+ while (idx >= 0) {
769
+ var key = keysA[idx];
770
+
771
+ if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
772
+ return false;
773
+ }
774
+
775
+ idx -= 1;
776
+ }
777
+
778
+ return true;
779
+ }
930
780
 
931
781
  /**
932
- * ap applies a list of functions to a list of values.
782
+ * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
783
+ * cyclical data structures.
933
784
  *
934
- * Dispatches to the `ap` method of the second argument, if present. Also
935
- * treats curried functions as applicatives.
785
+ * Dispatches symmetrically to the `equals` methods of both arguments, if
786
+ * present.
936
787
  *
937
788
  * @func
938
789
  * @memberOf R
939
- * @since v0.3.0
940
- * @category Function
941
- * @sig [a -> b] -> [a] -> [b]
942
- * @sig Apply f => f (a -> b) -> f a -> f b
943
- * @sig (r -> a -> b) -> (r -> a) -> (r -> b)
944
- * @param {*} applyF
945
- * @param {*} applyX
946
- * @return {*}
790
+ * @since v0.15.0
791
+ * @category Relation
792
+ * @sig a -> b -> Boolean
793
+ * @param {*} a
794
+ * @param {*} b
795
+ * @return {Boolean}
947
796
  * @example
948
797
  *
949
- * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
950
- * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"]
798
+ * R.equals(1, 1); //=> true
799
+ * R.equals(1, '1'); //=> false
800
+ * R.equals([1, 2, 3], [1, 2, 3]); //=> true
951
801
  *
952
- * // R.ap can also be used as S combinator
953
- * // when only two functions are passed
954
- * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA'
955
- * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)]
802
+ * const a = {}; a.v = a;
803
+ * const b = {}; b.v = b;
804
+ * R.equals(a, b); //=> true
956
805
  */
957
806
 
958
- var ap =
807
+ var equals =
959
808
  /*#__PURE__*/
960
- _curry2(function ap(applyF, applyX) {
961
- return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) {
962
- return applyF(x)(applyX(x));
963
- } : _reduce(function (acc, f) {
964
- return _concat(acc, map(f, applyX));
965
- }, [], applyF);
809
+ _curry2(function equals(a, b) {
810
+ return _equals(a, b, [], []);
966
811
  });
967
812
 
968
- /**
969
- * Makes a shallow clone of an object, setting or overriding the specified
970
- * property with the given value. Note that this copies and flattens prototype
971
- * properties onto the new object as well. All non-primitive properties are
972
- * copied by reference.
973
- *
974
- * @private
975
- * @param {String|Number} prop The property name to set
976
- * @param {*} val The new value
977
- * @param {Object|Array} obj The object to clone
978
- * @return {Object|Array} A new object equivalent to the original except for the changed property.
979
- */
813
+ function _map(fn, functor) {
814
+ var idx = 0;
815
+ var len = functor.length;
816
+ var result = Array(len);
980
817
 
981
- function _assoc(prop, val, obj) {
982
- if (_isInteger(prop) && _isArray(obj)) {
983
- var arr = [].concat(obj);
984
- arr[prop] = val;
985
- return arr;
818
+ while (idx < len) {
819
+ result[idx] = fn(functor[idx]);
820
+ idx += 1;
986
821
  }
987
822
 
988
- var result = {};
823
+ return result;
824
+ }
989
825
 
990
- for (var p in obj) {
991
- result[p] = obj[p];
826
+ function _arrayReduce(reducer, acc, list) {
827
+ var index = 0;
828
+ var length = list.length;
829
+
830
+ while (index < length) {
831
+ acc = reducer(acc, list[index]);
832
+ index += 1;
992
833
  }
993
834
 
994
- result[prop] = val;
995
- return result;
835
+ return acc;
996
836
  }
997
837
 
998
- /**
999
- * Checks if the input value is `null` or `undefined`.
1000
- *
1001
- * @func
1002
- * @memberOf R
1003
- * @since v0.9.0
1004
- * @category Type
1005
- * @sig * -> Boolean
1006
- * @param {*} x The value to test.
1007
- * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.
1008
- * @example
1009
- *
1010
- * R.isNil(null); //=> true
1011
- * R.isNil(undefined); //=> true
1012
- * R.isNil(0); //=> false
1013
- * R.isNil([]); //=> false
1014
- */
838
+ function _isObject(x) {
839
+ return Object.prototype.toString.call(x) === '[object Object]';
840
+ }
1015
841
 
1016
- var isNil =
842
+ var XMap =
1017
843
  /*#__PURE__*/
1018
- _curry1(function isNil(x) {
1019
- return x == null;
1020
- });
844
+ function () {
845
+ function XMap(f, xf) {
846
+ this.xf = xf;
847
+ this.f = f;
848
+ }
849
+
850
+ XMap.prototype['@@transducer/init'] = _xfBase.init;
851
+ XMap.prototype['@@transducer/result'] = _xfBase.result;
852
+
853
+ XMap.prototype['@@transducer/step'] = function (result, input) {
854
+ return this.xf['@@transducer/step'](result, this.f(input));
855
+ };
856
+
857
+ return XMap;
858
+ }();
859
+
860
+ var _xmap = function _xmap(f) {
861
+ return function (xf) {
862
+ return new XMap(f, xf);
863
+ };
864
+ };
1021
865
 
1022
866
  /**
1023
- * Makes a shallow clone of an object, setting or overriding the nodes required
1024
- * to create the given path, and placing the specific value at the tail end of
1025
- * that path. Note that this copies and flattens prototype properties onto the
1026
- * new object as well. All non-primitive properties are copied by reference.
867
+ * Takes a function and
868
+ * a [functor](https://github.com/fantasyland/fantasy-land#functor),
869
+ * applies the function to each of the functor's values, and returns
870
+ * a functor of the same shape.
871
+ *
872
+ * Ramda provides suitable `map` implementations for `Array` and `Object`,
873
+ * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
874
+ *
875
+ * Dispatches to the `map` method of the second argument, if present.
876
+ *
877
+ * Acts as a transducer if a transformer is given in list position.
878
+ *
879
+ * Also treats functions as functors and will compose them together.
1027
880
  *
1028
881
  * @func
1029
882
  * @memberOf R
1030
- * @since v0.8.0
1031
- * @category Object
1032
- * @typedefn Idx = String | Int | Symbol
1033
- * @sig [Idx] -> a -> {a} -> {a}
1034
- * @param {Array} path the path to set
1035
- * @param {*} val The new value
1036
- * @param {Object} obj The object to clone
1037
- * @return {Object} A new object equivalent to the original except along the specified path.
1038
- * @see R.dissocPath
883
+ * @since v0.1.0
884
+ * @category List
885
+ * @sig Functor f => (a -> b) -> f a -> f b
886
+ * @param {Function} fn The function to be called on every element of the input `list`.
887
+ * @param {Array} list The list to be iterated over.
888
+ * @return {Array} The new list.
889
+ * @see R.transduce, R.addIndex, R.pluck, R.project
1039
890
  * @example
1040
891
  *
1041
- * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}
892
+ * const double = x => x * 2;
1042
893
  *
1043
- * // Any missing or non-object keys in path will be overridden
1044
- * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}}
894
+ * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
895
+ *
896
+ * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
897
+ * @symb R.map(f, [a, b]) = [f(a), f(b)]
898
+ * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
899
+ * @symb R.map(f, functor_o) = functor_o.map(f)
1045
900
  */
1046
901
 
1047
- var assocPath =
902
+ var map =
1048
903
  /*#__PURE__*/
1049
- _curry3(function assocPath(path, val, obj) {
1050
- if (path.length === 0) {
1051
- return val;
1052
- }
904
+ _curry2(
905
+ /*#__PURE__*/
906
+ _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
907
+ switch (Object.prototype.toString.call(functor)) {
908
+ case '[object Function]':
909
+ return curryN(functor.length, function () {
910
+ return fn.call(this, functor.apply(this, arguments));
911
+ });
1053
912
 
1054
- var idx = path[0];
913
+ case '[object Object]':
914
+ return _arrayReduce(function (acc, key) {
915
+ acc[key] = fn(functor[key]);
916
+ return acc;
917
+ }, {}, keys(functor));
1055
918
 
1056
- if (path.length > 1) {
1057
- var nextObj = !isNil(obj) && _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {};
1058
- val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
919
+ default:
920
+ return _map(fn, functor);
1059
921
  }
922
+ }));
1060
923
 
1061
- return _assoc(idx, val, obj);
1062
- });
924
+ /**
925
+ * Determine if the passed argument is an integer.
926
+ *
927
+ * @private
928
+ * @param {*} n
929
+ * @category Type
930
+ * @return {Boolean}
931
+ */
932
+ var _isInteger = Number.isInteger || function _isInteger(n) {
933
+ return n << 0 === n;
934
+ };
935
+
936
+ function _isString(x) {
937
+ return Object.prototype.toString.call(x) === '[object String]';
938
+ }
1063
939
 
1064
940
  /**
1065
- * Makes a shallow clone of an object, setting or overriding the specified
1066
- * property with the given value. Note that this copies and flattens prototype
1067
- * properties onto the new object as well. All non-primitive properties are
1068
- * copied by reference.
941
+ * Returns the nth element of the given list or string. If n is negative the
942
+ * element at index length + n is returned.
1069
943
  *
1070
944
  * @func
1071
945
  * @memberOf R
1072
- * @since v0.8.0
1073
- * @category Object
1074
- * @typedefn Idx = String | Int
1075
- * @sig Idx -> a -> {k: v} -> {k: v}
1076
- * @param {String|Number} prop The property name to set
1077
- * @param {*} val The new value
1078
- * @param {Object} obj The object to clone
1079
- * @return {Object} A new object equivalent to the original except for the changed property.
1080
- * @see R.dissoc, R.pick
946
+ * @since v0.1.0
947
+ * @category List
948
+ * @sig Number -> [a] -> a | Undefined
949
+ * @sig Number -> String -> String
950
+ * @param {Number} offset
951
+ * @param {*} list
952
+ * @return {*}
1081
953
  * @example
1082
954
  *
1083
- * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
955
+ * const list = ['foo', 'bar', 'baz', 'quux'];
956
+ * R.nth(1, list); //=> 'bar'
957
+ * R.nth(-1, list); //=> 'quux'
958
+ * R.nth(-99, list); //=> undefined
959
+ *
960
+ * R.nth(2, 'abc'); //=> 'c'
961
+ * R.nth(3, 'abc'); //=> ''
962
+ * @symb R.nth(-1, [a, b, c]) = c
963
+ * @symb R.nth(0, [a, b, c]) = a
964
+ * @symb R.nth(1, [a, b, c]) = b
1084
965
  */
1085
966
 
1086
- var assoc =
967
+ var nth =
1087
968
  /*#__PURE__*/
1088
- _curry3(function assoc(prop, val, obj) {
1089
- return assocPath([prop], val, obj);
1090
- });
1091
-
1092
- function _isFunction(x) {
1093
- var type = Object.prototype.toString.call(x);
1094
- return type === '[object Function]' || type === '[object AsyncFunction]' || type === '[object GeneratorFunction]' || type === '[object AsyncGeneratorFunction]';
1095
- }
969
+ _curry2(function nth(offset, list) {
970
+ var idx = offset < 0 ? list.length + offset : offset;
971
+ return _isString(list) ? list.charAt(idx) : list[idx];
972
+ });
1096
973
 
1097
974
  /**
1098
- * "lifts" a function to be the specified arity, so that it may "map over" that
1099
- * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
975
+ * Returns a function that when supplied an object returns the indicated
976
+ * property of that object, if it exists.
1100
977
  *
1101
978
  * @func
1102
979
  * @memberOf R
1103
- * @since v0.7.0
1104
- * @category Function
1105
- * @sig Number -> (*... -> *) -> ([*]... -> [*])
1106
- * @param {Function} fn The function to lift into higher context
1107
- * @return {Function} The lifted function.
1108
- * @see R.lift, R.ap
980
+ * @since v0.1.0
981
+ * @category Object
982
+ * @typedefn Idx = String | Int | Symbol
983
+ * @sig Idx -> {s: a} -> a | Undefined
984
+ * @param {String|Number} p The property name or array index
985
+ * @param {Object} obj The object to query
986
+ * @return {*} The value at `obj.p`.
987
+ * @see R.path, R.props, R.pluck, R.project, R.nth
1109
988
  * @example
1110
989
  *
1111
- * const madd3 = R.liftN(3, (...args) => R.sum(args));
1112
- * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
990
+ * R.prop('x', {x: 100}); //=> 100
991
+ * R.prop('x', {}); //=> undefined
992
+ * R.prop(0, [100]); //=> 100
993
+ * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
1113
994
  */
1114
995
 
1115
- var liftN =
996
+ var prop =
1116
997
  /*#__PURE__*/
1117
- _curry2(function liftN(arity, fn) {
1118
- var lifted = curryN(arity, fn);
1119
- return curryN(arity, function () {
1120
- return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
1121
- });
998
+ _curry2(function prop(p, obj) {
999
+ if (obj == null) {
1000
+ return;
1001
+ }
1002
+
1003
+ return _isInteger(p) ? nth(p, obj) : obj[p];
1122
1004
  });
1123
1005
 
1124
1006
  /**
1125
- * "lifts" a function of arity >= 1 so that it may "map over" a list, Function or other
1126
- * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
1007
+ * Returns a new list by plucking the same named property off all objects in
1008
+ * the list supplied.
1009
+ *
1010
+ * `pluck` will work on
1011
+ * any [functor](https://github.com/fantasyland/fantasy-land#functor) in
1012
+ * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`.
1127
1013
  *
1128
1014
  * @func
1129
1015
  * @memberOf R
1130
- * @since v0.7.0
1131
- * @category Function
1132
- * @sig (*... -> *) -> ([*]... -> [*])
1133
- * @param {Function} fn The function to lift into higher context
1134
- * @return {Function} The lifted function.
1135
- * @see R.liftN
1016
+ * @since v0.1.0
1017
+ * @category List
1018
+ * @sig Functor f => k -> f {k: v} -> f v
1019
+ * @param {Number|String} key The key name to pluck off of each object.
1020
+ * @param {Array} f The array or functor to consider.
1021
+ * @return {Array} The list of values for the given key.
1022
+ * @see R.project, R.prop, R.props
1136
1023
  * @example
1137
1024
  *
1138
- * const madd3 = R.lift((a, b, c) => a + b + c);
1139
- *
1140
- * madd3([100, 200], [30, 40], [5, 6, 7]); //=> [135, 136, 137, 145, 146, 147, 235, 236, 237, 245, 246, 247]
1141
- *
1142
- * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
1025
+ * var getAges = R.pluck('age');
1026
+ * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
1143
1027
  *
1144
- * madd5([10, 20], [1], [2, 3], [4], [100, 200]); //=> [117, 217, 118, 218, 127, 227, 128, 228]
1028
+ * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3]
1029
+ * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
1030
+ * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
1031
+ * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
1145
1032
  */
1146
1033
 
1147
- var lift =
1034
+ var pluck =
1148
1035
  /*#__PURE__*/
1149
- _curry1(function lift(fn) {
1150
- return liftN(fn.length, fn);
1036
+ _curry2(function pluck(p, list) {
1037
+ return map(prop(p), list);
1151
1038
  });
1152
1039
 
1153
1040
  /**
1154
- * Gives a single-word string description of the (native) type of a value,
1155
- * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
1156
- * attempt to distinguish user Object types any further, reporting them all as
1157
- * 'Object'.
1041
+ * Tests whether or not an object is similar to an array.
1158
1042
  *
1159
- * @func
1160
- * @memberOf R
1161
- * @since v0.8.0
1043
+ * @private
1162
1044
  * @category Type
1163
- * @sig (* -> {*}) -> String
1164
- * @param {*} val The value to test
1165
- * @return {String}
1045
+ * @category List
1046
+ * @sig * -> Boolean
1047
+ * @param {*} x The object to test.
1048
+ * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
1166
1049
  * @example
1167
1050
  *
1168
- * R.type({}); //=> "Object"
1169
- * R.type(1); //=> "Number"
1170
- * R.type(false); //=> "Boolean"
1171
- * R.type('s'); //=> "String"
1172
- * R.type(null); //=> "Null"
1173
- * R.type([]); //=> "Array"
1174
- * R.type(/[A-z]/); //=> "RegExp"
1175
- * R.type(() => {}); //=> "Function"
1176
- * R.type(undefined); //=> "Undefined"
1051
+ * _isArrayLike([]); //=> true
1052
+ * _isArrayLike(true); //=> false
1053
+ * _isArrayLike({}); //=> false
1054
+ * _isArrayLike({length: 10}); //=> false
1055
+ * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
1056
+ * _isArrayLike({nodeType: 1, length: 1}) // => false
1177
1057
  */
1178
1058
 
1179
- var type =
1059
+ var _isArrayLike =
1180
1060
  /*#__PURE__*/
1181
- _curry1(function type(val) {
1182
- return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
1183
- });
1184
-
1185
- function _arrayFromIterator(iter) {
1186
- var list = [];
1187
- var next;
1061
+ _curry1(function isArrayLike(x) {
1062
+ if (_isArray(x)) {
1063
+ return true;
1064
+ }
1188
1065
 
1189
- while (!(next = iter.next()).done) {
1190
- list.push(next.value);
1066
+ if (!x) {
1067
+ return false;
1191
1068
  }
1192
1069
 
1193
- return list;
1194
- }
1070
+ if (typeof x !== 'object') {
1071
+ return false;
1072
+ }
1195
1073
 
1196
- function _includesWith(pred, x, list) {
1197
- var idx = 0;
1198
- var len = list.length;
1074
+ if (_isString(x)) {
1075
+ return false;
1076
+ }
1199
1077
 
1200
- while (idx < len) {
1201
- if (pred(x, list[idx])) {
1202
- return true;
1203
- }
1078
+ if (x.length === 0) {
1079
+ return true;
1080
+ }
1204
1081
 
1205
- idx += 1;
1082
+ if (x.length > 0) {
1083
+ return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
1206
1084
  }
1207
1085
 
1208
1086
  return false;
1209
- }
1210
-
1211
- function _functionName(f) {
1212
- // String(x => x) evaluates to "x => x", so the pattern may not match.
1213
- var match = String(f).match(/^function (\w*)/);
1214
- return match == null ? '' : match[1];
1215
- }
1216
-
1217
- // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1218
- function _objectIs(a, b) {
1219
- // SameValue algorithm
1220
- if (a === b) {
1221
- // Steps 1-5, 7-10
1222
- // Steps 6.b-6.e: +0 != -0
1223
- return a !== 0 || 1 / a === 1 / b;
1224
- } else {
1225
- // Step 6.a: NaN == NaN
1226
- return a !== a && b !== b;
1227
- }
1228
- }
1087
+ });
1229
1088
 
1230
- var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
1089
+ var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
1090
+ function _createReduce(arrayReduce, methodReduce, iterableReduce) {
1091
+ return function _reduce(xf, acc, list) {
1092
+ if (_isArrayLike(list)) {
1093
+ return arrayReduce(xf, acc, list);
1094
+ }
1231
1095
 
1232
- /**
1233
- * private _uniqContentEquals function.
1234
- * That function is checking equality of 2 iterator contents with 2 assumptions
1235
- * - iterators lengths are the same
1236
- * - iterators values are unique
1237
- *
1238
- * false-positive result will be returned for comparison of, e.g.
1239
- * - [1,2,3] and [1,2,3,4]
1240
- * - [1,1,1] and [1,2,3]
1241
- * */
1096
+ if (list == null) {
1097
+ return acc;
1098
+ }
1242
1099
 
1243
- function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
1244
- var a = _arrayFromIterator(aIterator);
1100
+ if (typeof list['fantasy-land/reduce'] === 'function') {
1101
+ return methodReduce(xf, acc, list, 'fantasy-land/reduce');
1102
+ }
1245
1103
 
1246
- var b = _arrayFromIterator(bIterator);
1104
+ if (list[symIterator] != null) {
1105
+ return iterableReduce(xf, acc, list[symIterator]());
1106
+ }
1247
1107
 
1248
- function eq(_a, _b) {
1249
- return _equals(_a, _b, stackA.slice(), stackB.slice());
1250
- } // if *a* array contains any element that is not included in *b*
1108
+ if (typeof list.next === 'function') {
1109
+ return iterableReduce(xf, acc, list);
1110
+ }
1251
1111
 
1112
+ if (typeof list.reduce === 'function') {
1113
+ return methodReduce(xf, acc, list, 'reduce');
1114
+ }
1252
1115
 
1253
- return !_includesWith(function (b, aItem) {
1254
- return !_includesWith(eq, aItem, b);
1255
- }, b, a);
1116
+ throw new TypeError('reduce: list must be array or iterable');
1117
+ };
1256
1118
  }
1257
1119
 
1258
- function _equals(a, b, stackA, stackB) {
1259
- if (_objectIs$1(a, b)) {
1260
- return true;
1261
- }
1262
-
1263
- var typeA = type(a);
1264
-
1265
- if (typeA !== type(b)) {
1266
- return false;
1267
- }
1268
-
1269
- if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
1270
- return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
1271
- }
1120
+ function _iterableReduce(reducer, acc, iter) {
1121
+ var step = iter.next();
1272
1122
 
1273
- if (typeof a.equals === 'function' || typeof b.equals === 'function') {
1274
- return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
1123
+ while (!step.done) {
1124
+ acc = reducer(acc, step.value);
1125
+ step = iter.next();
1275
1126
  }
1276
1127
 
1277
- switch (typeA) {
1278
- case 'Arguments':
1279
- case 'Array':
1280
- case 'Object':
1281
- if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
1282
- return a === b;
1283
- }
1284
-
1285
- break;
1286
-
1287
- case 'Boolean':
1288
- case 'Number':
1289
- case 'String':
1290
- if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
1291
- return false;
1292
- }
1128
+ return acc;
1129
+ }
1293
1130
 
1294
- break;
1131
+ function _methodReduce(reducer, acc, obj, methodName) {
1132
+ return obj[methodName](reducer, acc);
1133
+ }
1295
1134
 
1296
- case 'Date':
1297
- if (!_objectIs$1(a.valueOf(), b.valueOf())) {
1298
- return false;
1299
- }
1135
+ var _reduce =
1136
+ /*#__PURE__*/
1137
+ _createReduce(_arrayReduce, _methodReduce, _iterableReduce);
1300
1138
 
1301
- break;
1139
+ /**
1140
+ * ap applies a list of functions to a list of values.
1141
+ *
1142
+ * Dispatches to the `ap` method of the first argument, if present. Also
1143
+ * treats curried functions as applicatives.
1144
+ *
1145
+ * @func
1146
+ * @memberOf R
1147
+ * @since v0.3.0
1148
+ * @category Function
1149
+ * @sig [a -> b] -> [a] -> [b]
1150
+ * @sig Apply f => f (a -> b) -> f a -> f b
1151
+ * @sig (r -> a -> b) -> (r -> a) -> (r -> b)
1152
+ * @param {*} applyF
1153
+ * @param {*} applyX
1154
+ * @return {*}
1155
+ * @example
1156
+ *
1157
+ * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
1158
+ * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"]
1159
+ *
1160
+ * // R.ap can also be used as S combinator
1161
+ * // when only two functions are passed
1162
+ * R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA'
1163
+ * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)]
1164
+ */
1302
1165
 
1303
- case 'Error':
1304
- return a.name === b.name && a.message === b.message;
1166
+ var ap =
1167
+ /*#__PURE__*/
1168
+ _curry2(function ap(applyF, applyX) {
1169
+ return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) {
1170
+ return applyF(x)(applyX(x));
1171
+ } : _reduce(function (acc, f) {
1172
+ return _concat(acc, map(f, applyX));
1173
+ }, [], applyF);
1174
+ });
1305
1175
 
1306
- case 'RegExp':
1307
- if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
1308
- return false;
1309
- }
1176
+ /**
1177
+ * Makes a shallow clone of an object, setting or overriding the specified
1178
+ * property with the given value. Note that this copies and flattens prototype
1179
+ * properties onto the new object as well. All non-primitive properties are
1180
+ * copied by reference.
1181
+ *
1182
+ * @private
1183
+ * @param {String|Number} prop The property name to set
1184
+ * @param {*} val The new value
1185
+ * @param {Object|Array} obj The object to clone
1186
+ * @return {Object|Array} A new object equivalent to the original except for the changed property.
1187
+ */
1310
1188
 
1311
- break;
1189
+ function _assoc(prop, val, obj) {
1190
+ if (_isInteger(prop) && _isArray(obj)) {
1191
+ var arr = [].concat(obj);
1192
+ arr[prop] = val;
1193
+ return arr;
1312
1194
  }
1313
1195
 
1314
- var idx = stackA.length - 1;
1315
-
1316
- while (idx >= 0) {
1317
- if (stackA[idx] === a) {
1318
- return stackB[idx] === b;
1319
- }
1196
+ var result = {};
1320
1197
 
1321
- idx -= 1;
1198
+ for (var p in obj) {
1199
+ result[p] = obj[p];
1322
1200
  }
1323
1201
 
1324
- switch (typeA) {
1325
- case 'Map':
1326
- if (a.size !== b.size) {
1327
- return false;
1328
- }
1329
-
1330
- return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
1202
+ result[prop] = val;
1203
+ return result;
1204
+ }
1331
1205
 
1332
- case 'Set':
1333
- if (a.size !== b.size) {
1334
- return false;
1335
- }
1206
+ /**
1207
+ * Checks if the input value is `null` or `undefined`.
1208
+ *
1209
+ * @func
1210
+ * @memberOf R
1211
+ * @since v0.9.0
1212
+ * @category Type
1213
+ * @sig * -> Boolean
1214
+ * @param {*} x The value to test.
1215
+ * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.
1216
+ * @example
1217
+ *
1218
+ * R.isNil(null); //=> true
1219
+ * R.isNil(undefined); //=> true
1220
+ * R.isNil(0); //=> false
1221
+ * R.isNil([]); //=> false
1222
+ */
1336
1223
 
1337
- return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
1224
+ var isNil =
1225
+ /*#__PURE__*/
1226
+ _curry1(function isNil(x) {
1227
+ return x == null;
1228
+ });
1338
1229
 
1339
- case 'Arguments':
1340
- case 'Array':
1341
- case 'Object':
1342
- case 'Boolean':
1343
- case 'Number':
1344
- case 'String':
1345
- case 'Date':
1346
- case 'Error':
1347
- case 'RegExp':
1348
- case 'Int8Array':
1349
- case 'Uint8Array':
1350
- case 'Uint8ClampedArray':
1351
- case 'Int16Array':
1352
- case 'Uint16Array':
1353
- case 'Int32Array':
1354
- case 'Uint32Array':
1355
- case 'Float32Array':
1356
- case 'Float64Array':
1357
- case 'ArrayBuffer':
1358
- break;
1230
+ /**
1231
+ * Makes a shallow clone of an object, setting or overriding the nodes required
1232
+ * to create the given path, and placing the specific value at the tail end of
1233
+ * that path. Note that this copies and flattens prototype properties onto the
1234
+ * new object as well. All non-primitive properties are copied by reference.
1235
+ *
1236
+ * @func
1237
+ * @memberOf R
1238
+ * @since v0.8.0
1239
+ * @category Object
1240
+ * @typedefn Idx = String | Int | Symbol
1241
+ * @sig [Idx] -> a -> {a} -> {a}
1242
+ * @param {Array} path the path to set
1243
+ * @param {*} val The new value
1244
+ * @param {Object} obj The object to clone
1245
+ * @return {Object} A new object equivalent to the original except along the specified path.
1246
+ * @see R.dissocPath
1247
+ * @example
1248
+ *
1249
+ * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}
1250
+ *
1251
+ * // Any missing or non-object keys in path will be overridden
1252
+ * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}}
1253
+ */
1359
1254
 
1360
- default:
1361
- // Values of other types are only equal if identical.
1362
- return false;
1255
+ var assocPath =
1256
+ /*#__PURE__*/
1257
+ _curry3(function assocPath(path, val, obj) {
1258
+ if (path.length === 0) {
1259
+ return val;
1363
1260
  }
1364
1261
 
1365
- var keysA = keys(a);
1262
+ var idx = path[0];
1366
1263
 
1367
- if (keysA.length !== keys(b).length) {
1368
- return false;
1264
+ if (path.length > 1) {
1265
+ var nextObj = !isNil(obj) && _has(idx, obj) && typeof obj[idx] === 'object' ? obj[idx] : _isInteger(path[1]) ? [] : {};
1266
+ val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
1369
1267
  }
1370
1268
 
1371
- var extendedStackA = stackA.concat([a]);
1372
- var extendedStackB = stackB.concat([b]);
1373
- idx = keysA.length - 1;
1374
-
1375
- while (idx >= 0) {
1376
- var key = keysA[idx];
1269
+ return _assoc(idx, val, obj);
1270
+ });
1377
1271
 
1378
- if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
1379
- return false;
1380
- }
1272
+ /**
1273
+ * Makes a shallow clone of an object, setting or overriding the specified
1274
+ * property with the given value. Note that this copies and flattens prototype
1275
+ * properties onto the new object as well. All non-primitive properties are
1276
+ * copied by reference.
1277
+ *
1278
+ * @func
1279
+ * @memberOf R
1280
+ * @since v0.8.0
1281
+ * @category Object
1282
+ * @typedefn Idx = String | Int
1283
+ * @sig Idx -> a -> {k: v} -> {k: v}
1284
+ * @param {String|Number} prop The property name to set
1285
+ * @param {*} val The new value
1286
+ * @param {Object} obj The object to clone
1287
+ * @return {Object} A new object equivalent to the original except for the changed property.
1288
+ * @see R.dissoc, R.pick
1289
+ * @example
1290
+ *
1291
+ * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
1292
+ */
1381
1293
 
1382
- idx -= 1;
1383
- }
1294
+ var assoc =
1295
+ /*#__PURE__*/
1296
+ _curry3(function assoc(prop, val, obj) {
1297
+ return assocPath([prop], val, obj);
1298
+ });
1384
1299
 
1385
- return true;
1300
+ function _isFunction(x) {
1301
+ var type = Object.prototype.toString.call(x);
1302
+ return type === '[object Function]' || type === '[object AsyncFunction]' || type === '[object GeneratorFunction]' || type === '[object AsyncGeneratorFunction]';
1386
1303
  }
1387
1304
 
1388
1305
  /**
1389
- * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
1390
- * cyclical data structures.
1306
+ * "lifts" a function to be the specified arity, so that it may "map over" that
1307
+ * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
1391
1308
  *
1392
- * Dispatches symmetrically to the `equals` methods of both arguments, if
1393
- * present.
1309
+ * @func
1310
+ * @memberOf R
1311
+ * @since v0.7.0
1312
+ * @category Function
1313
+ * @sig Number -> (*... -> *) -> ([*]... -> [*])
1314
+ * @param {Function} fn The function to lift into higher context
1315
+ * @return {Function} The lifted function.
1316
+ * @see R.lift, R.ap
1317
+ * @example
1318
+ *
1319
+ * const madd3 = R.liftN(3, (...args) => R.sum(args));
1320
+ * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
1321
+ */
1322
+
1323
+ var liftN =
1324
+ /*#__PURE__*/
1325
+ _curry2(function liftN(arity, fn) {
1326
+ var lifted = curryN(arity, fn);
1327
+ return curryN(arity, function () {
1328
+ return _arrayReduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
1329
+ });
1330
+ });
1331
+
1332
+ /**
1333
+ * "lifts" a function of arity >= 1 so that it may "map over" a list, Function or other
1334
+ * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
1394
1335
  *
1395
1336
  * @func
1396
1337
  * @memberOf R
1397
- * @since v0.15.0
1398
- * @category Relation
1399
- * @sig a -> b -> Boolean
1400
- * @param {*} a
1401
- * @param {*} b
1402
- * @return {Boolean}
1338
+ * @since v0.7.0
1339
+ * @category Function
1340
+ * @sig (*... -> *) -> ([*]... -> [*])
1341
+ * @param {Function} fn The function to lift into higher context
1342
+ * @return {Function} The lifted function.
1343
+ * @see R.liftN
1403
1344
  * @example
1404
1345
  *
1405
- * R.equals(1, 1); //=> true
1406
- * R.equals(1, '1'); //=> false
1407
- * R.equals([1, 2, 3], [1, 2, 3]); //=> true
1346
+ * const madd3 = R.lift((a, b, c) => a + b + c);
1408
1347
  *
1409
- * const a = {}; a.v = a;
1410
- * const b = {}; b.v = b;
1411
- * R.equals(a, b); //=> true
1348
+ * madd3([100, 200], [30, 40], [5, 6, 7]); //=> [135, 136, 137, 145, 146, 147, 235, 236, 237, 245, 246, 247]
1349
+ *
1350
+ * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
1351
+ *
1352
+ * madd5([10, 20], [1], [2, 3], [4], [100, 200]); //=> [117, 217, 118, 218, 127, 227, 128, 228]
1412
1353
  */
1413
1354
 
1414
- var equals =
1355
+ var lift =
1415
1356
  /*#__PURE__*/
1416
- _curry2(function equals(a, b) {
1417
- return _equals(a, b, [], []);
1357
+ _curry1(function lift(fn) {
1358
+ return liftN(fn.length, fn);
1418
1359
  });
1419
1360
 
1420
- function _isObject(x) {
1421
- return Object.prototype.toString.call(x) === '[object Object]';
1422
- }
1423
-
1424
1361
  /**
1425
1362
  * Returns the first argument if it is truthy, otherwise the second argument.
1426
1363
  * Acts as the boolean `or` statement if both inputs are `Boolean`s.
@@ -1466,7 +1403,7 @@ _curry2(function or(a, b) {
1466
1403
  * @param {Function} f a predicate
1467
1404
  * @param {Function} g another predicate
1468
1405
  * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.
1469
- * @see R.both, R.or
1406
+ * @see R.both, R.anyPass, R.or
1470
1407
  * @example
1471
1408
  *
1472
1409
  * const gt10 = x => x > 10;