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