@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/index.js CHANGED
@@ -550,224 +550,56 @@ var _xfBase = {
550
550
  }
551
551
  };
552
552
 
553
- function _map(fn, functor) {
554
- var idx = 0;
555
- var len = functor.length;
556
- var result = Array(len);
557
-
558
- while (idx < len) {
559
- result[idx] = fn(functor[idx]);
560
- idx += 1;
561
- }
562
-
563
- return result;
564
- }
565
-
566
- function _isString(x) {
567
- return Object.prototype.toString.call(x) === '[object String]';
568
- }
569
-
570
- /**
571
- * Tests whether or not an object is similar to an array.
572
- *
573
- * @private
574
- * @category Type
575
- * @category List
576
- * @sig * -> Boolean
577
- * @param {*} x The object to test.
578
- * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
579
- * @example
580
- *
581
- * _isArrayLike([]); //=> true
582
- * _isArrayLike(true); //=> false
583
- * _isArrayLike({}); //=> false
584
- * _isArrayLike({length: 10}); //=> false
585
- * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
586
- * _isArrayLike({nodeType: 1, length: 1}) // => false
587
- */
588
-
589
- var _isArrayLike =
590
- /*#__PURE__*/
591
- _curry1(function isArrayLike(x) {
592
- if (_isArray$1(x)) {
593
- return true;
594
- }
595
-
596
- if (!x) {
597
- return false;
598
- }
599
-
600
- if (typeof x !== 'object') {
601
- return false;
602
- }
603
-
604
- if (_isString(x)) {
605
- return false;
606
- }
607
-
608
- if (x.length === 0) {
609
- return true;
610
- }
611
-
612
- if (x.length > 0) {
613
- return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
614
- }
615
-
616
- return false;
617
- });
553
+ function _arrayFromIterator(iter) {
554
+ var list = [];
555
+ var next;
618
556
 
619
- var XWrap =
620
- /*#__PURE__*/
621
- function () {
622
- function XWrap(fn) {
623
- this.f = fn;
557
+ while (!(next = iter.next()).done) {
558
+ list.push(next.value);
624
559
  }
625
560
 
626
- XWrap.prototype['@@transducer/init'] = function () {
627
- throw new Error('init not implemented on XWrap');
628
- };
629
-
630
- XWrap.prototype['@@transducer/result'] = function (acc) {
631
- return acc;
632
- };
633
-
634
- XWrap.prototype['@@transducer/step'] = function (acc, x) {
635
- return this.f(acc, x);
636
- };
637
-
638
- return XWrap;
639
- }();
640
-
641
- function _xwrap(fn) {
642
- return new XWrap(fn);
561
+ return list;
643
562
  }
644
563
 
645
- /**
646
- * Creates a function that is bound to a context.
647
- * Note: `R.bind` does not provide the additional argument-binding capabilities of
648
- * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
649
- *
650
- * @func
651
- * @memberOf R
652
- * @since v0.6.0
653
- * @category Function
654
- * @category Object
655
- * @sig (* -> *) -> {*} -> (* -> *)
656
- * @param {Function} fn The function to bind to context
657
- * @param {Object} thisObj The context to bind `fn` to
658
- * @return {Function} A function that will execute in the context of `thisObj`.
659
- * @see R.partial
660
- * @example
661
- *
662
- * const log = R.bind(console.log, console);
663
- * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
664
- * // logs {a: 2}
665
- * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
666
- */
667
-
668
- var bind =
669
- /*#__PURE__*/
670
- _curry2(function bind(fn, thisObj) {
671
- return _arity(fn.length, function () {
672
- return fn.apply(thisObj, arguments);
673
- });
674
- });
675
-
676
- function _arrayReduce(xf, acc, list) {
564
+ function _includesWith(pred, x, list) {
677
565
  var idx = 0;
678
566
  var len = list.length;
679
567
 
680
568
  while (idx < len) {
681
- acc = xf['@@transducer/step'](acc, list[idx]);
682
-
683
- if (acc && acc['@@transducer/reduced']) {
684
- acc = acc['@@transducer/value'];
685
- break;
569
+ if (pred(x, list[idx])) {
570
+ return true;
686
571
  }
687
572
 
688
573
  idx += 1;
689
574
  }
690
575
 
691
- return xf['@@transducer/result'](acc);
576
+ return false;
692
577
  }
693
578
 
694
- function _iterableReduce(xf, acc, iter) {
695
- var step = iter.next();
696
-
697
- while (!step.done) {
698
- acc = xf['@@transducer/step'](acc, step.value);
699
-
700
- if (acc && acc['@@transducer/reduced']) {
701
- acc = acc['@@transducer/value'];
702
- break;
703
- }
704
-
705
- step = iter.next();
706
- }
707
-
708
- return xf['@@transducer/result'](acc);
579
+ function _functionName(f) {
580
+ // String(x => x) evaluates to "x => x", so the pattern may not match.
581
+ var match = String(f).match(/^function (\w*)/);
582
+ return match == null ? '' : match[1];
709
583
  }
710
584
 
711
- function _methodReduce(xf, acc, obj, methodName) {
712
- return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
585
+ function _has$1(prop, obj) {
586
+ return Object.prototype.hasOwnProperty.call(obj, prop);
713
587
  }
714
588
 
715
- var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
716
- function _reduce(fn, acc, list) {
717
- if (typeof fn === 'function') {
718
- fn = _xwrap(fn);
719
- }
720
-
721
- if (_isArrayLike(list)) {
722
- return _arrayReduce(fn, acc, list);
723
- }
724
-
725
- if (typeof list['fantasy-land/reduce'] === 'function') {
726
- return _methodReduce(fn, acc, list, 'fantasy-land/reduce');
727
- }
728
-
729
- if (list[symIterator] != null) {
730
- return _iterableReduce(fn, acc, list[symIterator]());
731
- }
732
-
733
- if (typeof list.next === 'function') {
734
- return _iterableReduce(fn, acc, list);
735
- }
736
-
737
- if (typeof list.reduce === 'function') {
738
- return _methodReduce(fn, acc, list, 'reduce');
589
+ // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
590
+ function _objectIs(a, b) {
591
+ // SameValue algorithm
592
+ if (a === b) {
593
+ // Steps 1-5, 7-10
594
+ // Steps 6.b-6.e: +0 != -0
595
+ return a !== 0 || 1 / a === 1 / b;
596
+ } else {
597
+ // Step 6.a: NaN == NaN
598
+ return a !== a && b !== b;
739
599
  }
740
-
741
- throw new TypeError('reduce: list must be array or iterable');
742
600
  }
743
601
 
744
- var XMap =
745
- /*#__PURE__*/
746
- function () {
747
- function XMap(f, xf) {
748
- this.xf = xf;
749
- this.f = f;
750
- }
751
-
752
- XMap.prototype['@@transducer/init'] = _xfBase.init;
753
- XMap.prototype['@@transducer/result'] = _xfBase.result;
754
-
755
- XMap.prototype['@@transducer/step'] = function (result, input) {
756
- return this.xf['@@transducer/step'](result, this.f(input));
757
- };
758
-
759
- return XMap;
760
- }();
761
-
762
- var _xmap =
763
- /*#__PURE__*/
764
- _curry2(function _xmap(f, xf) {
765
- return new XMap(f, xf);
766
- });
767
-
768
- function _has$1(prop, obj) {
769
- return Object.prototype.hasOwnProperty.call(obj, prop);
770
- }
602
+ var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
771
603
 
772
604
  var toString$2 = Object.prototype.toString;
773
605
 
@@ -868,81 +700,358 @@ _curry1(function keys(obj) {
868
700
  });
869
701
 
870
702
  /**
871
- * Takes a function and
872
- * a [functor](https://github.com/fantasyland/fantasy-land#functor),
873
- * applies the function to each of the functor's values, and returns
874
- * a functor of the same shape.
875
- *
876
- * Ramda provides suitable `map` implementations for `Array` and `Object`,
877
- * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
878
- *
879
- * Dispatches to the `map` method of the second argument, if present.
880
- *
881
- * Acts as a transducer if a transformer is given in list position.
882
- *
883
- * Also treats functions as functors and will compose them together.
703
+ * Gives a single-word string description of the (native) type of a value,
704
+ * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
705
+ * attempt to distinguish user Object types any further, reporting them all as
706
+ * 'Object'.
884
707
  *
885
708
  * @func
886
709
  * @memberOf R
887
- * @since v0.1.0
888
- * @category List
889
- * @sig Functor f => (a -> b) -> f a -> f b
890
- * @param {Function} fn The function to be called on every element of the input `list`.
891
- * @param {Array} list The list to be iterated over.
892
- * @return {Array} The new list.
893
- * @see R.transduce, R.addIndex, R.pluck, R.project
710
+ * @since v0.8.0
711
+ * @category Type
712
+ * @sig * -> String
713
+ * @param {*} val The value to test
714
+ * @return {String}
894
715
  * @example
895
716
  *
896
- * const double = x => x * 2;
897
- *
898
- * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
899
- *
900
- * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
901
- * @symb R.map(f, [a, b]) = [f(a), f(b)]
902
- * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
903
- * @symb R.map(f, functor_o) = functor_o.map(f)
717
+ * R.type({}); //=> "Object"
718
+ * R.type(1); //=> "Number"
719
+ * R.type(false); //=> "Boolean"
720
+ * R.type('s'); //=> "String"
721
+ * R.type(null); //=> "Null"
722
+ * R.type([]); //=> "Array"
723
+ * R.type(/[A-z]/); //=> "RegExp"
724
+ * R.type(() => {}); //=> "Function"
725
+ * R.type(undefined); //=> "Undefined"
904
726
  */
905
727
 
906
- var map =
907
- /*#__PURE__*/
908
- _curry2(
728
+ var type =
909
729
  /*#__PURE__*/
910
- _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
911
- switch (Object.prototype.toString.call(functor)) {
912
- case '[object Function]':
913
- return curryN(functor.length, function () {
914
- return fn.call(this, functor.apply(this, arguments));
915
- });
916
-
917
- case '[object Object]':
918
- return _reduce(function (acc, key) {
919
- acc[key] = fn(functor[key]);
920
- return acc;
921
- }, {}, keys(functor));
922
-
923
- default:
924
- return _map(fn, functor);
925
- }
926
- }));
730
+ _curry1(function type(val) {
731
+ return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
732
+ });
927
733
 
928
734
  /**
929
- * Determine if the passed argument is an integer.
735
+ * private _uniqContentEquals function.
736
+ * That function is checking equality of 2 iterator contents with 2 assumptions
737
+ * - iterators lengths are the same
738
+ * - iterators values are unique
930
739
  *
931
- * @private
932
- * @param {*} n
933
- * @category Type
934
- * @return {Boolean}
935
- */
936
- var _isInteger = Number.isInteger || function _isInteger(n) {
937
- return n << 0 === n;
938
- };
740
+ * false-positive result will be returned for comparison of, e.g.
741
+ * - [1,2,3] and [1,2,3,4]
742
+ * - [1,1,1] and [1,2,3]
743
+ * */
939
744
 
940
- /**
941
- * Returns the nth element of the given list or string. If n is negative the
942
- * element at index length + n is returned.
943
- *
944
- * @func
945
- * @memberOf R
745
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
746
+ var a = _arrayFromIterator(aIterator);
747
+
748
+ var b = _arrayFromIterator(bIterator);
749
+
750
+ function eq(_a, _b) {
751
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
752
+ } // if *a* array contains any element that is not included in *b*
753
+
754
+
755
+ return !_includesWith(function (b, aItem) {
756
+ return !_includesWith(eq, aItem, b);
757
+ }, b, a);
758
+ }
759
+
760
+ function _equals(a, b, stackA, stackB) {
761
+ if (_objectIs$1(a, b)) {
762
+ return true;
763
+ }
764
+
765
+ var typeA = type(a);
766
+
767
+ if (typeA !== type(b)) {
768
+ return false;
769
+ }
770
+
771
+ if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
772
+ return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
773
+ }
774
+
775
+ if (typeof a.equals === 'function' || typeof b.equals === 'function') {
776
+ return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
777
+ }
778
+
779
+ switch (typeA) {
780
+ case 'Arguments':
781
+ case 'Array':
782
+ case 'Object':
783
+ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
784
+ return a === b;
785
+ }
786
+
787
+ break;
788
+
789
+ case 'Boolean':
790
+ case 'Number':
791
+ case 'String':
792
+ if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
793
+ return false;
794
+ }
795
+
796
+ break;
797
+
798
+ case 'Date':
799
+ if (!_objectIs$1(a.valueOf(), b.valueOf())) {
800
+ return false;
801
+ }
802
+
803
+ break;
804
+
805
+ case 'Error':
806
+ return a.name === b.name && a.message === b.message;
807
+
808
+ case 'RegExp':
809
+ 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)) {
810
+ return false;
811
+ }
812
+
813
+ break;
814
+ }
815
+
816
+ var idx = stackA.length - 1;
817
+
818
+ while (idx >= 0) {
819
+ if (stackA[idx] === a) {
820
+ return stackB[idx] === b;
821
+ }
822
+
823
+ idx -= 1;
824
+ }
825
+
826
+ switch (typeA) {
827
+ case 'Map':
828
+ if (a.size !== b.size) {
829
+ return false;
830
+ }
831
+
832
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
833
+
834
+ case 'Set':
835
+ if (a.size !== b.size) {
836
+ return false;
837
+ }
838
+
839
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
840
+
841
+ case 'Arguments':
842
+ case 'Array':
843
+ case 'Object':
844
+ case 'Boolean':
845
+ case 'Number':
846
+ case 'String':
847
+ case 'Date':
848
+ case 'Error':
849
+ case 'RegExp':
850
+ case 'Int8Array':
851
+ case 'Uint8Array':
852
+ case 'Uint8ClampedArray':
853
+ case 'Int16Array':
854
+ case 'Uint16Array':
855
+ case 'Int32Array':
856
+ case 'Uint32Array':
857
+ case 'Float32Array':
858
+ case 'Float64Array':
859
+ case 'ArrayBuffer':
860
+ break;
861
+
862
+ default:
863
+ // Values of other types are only equal if identical.
864
+ return false;
865
+ }
866
+
867
+ var keysA = keys(a);
868
+
869
+ if (keysA.length !== keys(b).length) {
870
+ return false;
871
+ }
872
+
873
+ var extendedStackA = stackA.concat([a]);
874
+ var extendedStackB = stackB.concat([b]);
875
+ idx = keysA.length - 1;
876
+
877
+ while (idx >= 0) {
878
+ var key = keysA[idx];
879
+
880
+ if (!(_has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
881
+ return false;
882
+ }
883
+
884
+ idx -= 1;
885
+ }
886
+
887
+ return true;
888
+ }
889
+
890
+ /**
891
+ * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
892
+ * cyclical data structures.
893
+ *
894
+ * Dispatches symmetrically to the `equals` methods of both arguments, if
895
+ * present.
896
+ *
897
+ * @func
898
+ * @memberOf R
899
+ * @since v0.15.0
900
+ * @category Relation
901
+ * @sig a -> b -> Boolean
902
+ * @param {*} a
903
+ * @param {*} b
904
+ * @return {Boolean}
905
+ * @example
906
+ *
907
+ * R.equals(1, 1); //=> true
908
+ * R.equals(1, '1'); //=> false
909
+ * R.equals([1, 2, 3], [1, 2, 3]); //=> true
910
+ *
911
+ * const a = {}; a.v = a;
912
+ * const b = {}; b.v = b;
913
+ * R.equals(a, b); //=> true
914
+ */
915
+
916
+ var equals =
917
+ /*#__PURE__*/
918
+ _curry2(function equals(a, b) {
919
+ return _equals(a, b, [], []);
920
+ });
921
+
922
+ function _map(fn, functor) {
923
+ var idx = 0;
924
+ var len = functor.length;
925
+ var result = Array(len);
926
+
927
+ while (idx < len) {
928
+ result[idx] = fn(functor[idx]);
929
+ idx += 1;
930
+ }
931
+
932
+ return result;
933
+ }
934
+
935
+ function _arrayReduce(reducer, acc, list) {
936
+ var index = 0;
937
+ var length = list.length;
938
+
939
+ while (index < length) {
940
+ acc = reducer(acc, list[index]);
941
+ index += 1;
942
+ }
943
+
944
+ return acc;
945
+ }
946
+
947
+ function _isObject$1(x) {
948
+ return Object.prototype.toString.call(x) === '[object Object]';
949
+ }
950
+
951
+ var XMap =
952
+ /*#__PURE__*/
953
+ function () {
954
+ function XMap(f, xf) {
955
+ this.xf = xf;
956
+ this.f = f;
957
+ }
958
+
959
+ XMap.prototype['@@transducer/init'] = _xfBase.init;
960
+ XMap.prototype['@@transducer/result'] = _xfBase.result;
961
+
962
+ XMap.prototype['@@transducer/step'] = function (result, input) {
963
+ return this.xf['@@transducer/step'](result, this.f(input));
964
+ };
965
+
966
+ return XMap;
967
+ }();
968
+
969
+ var _xmap = function _xmap(f) {
970
+ return function (xf) {
971
+ return new XMap(f, xf);
972
+ };
973
+ };
974
+
975
+ /**
976
+ * Takes a function and
977
+ * a [functor](https://github.com/fantasyland/fantasy-land#functor),
978
+ * applies the function to each of the functor's values, and returns
979
+ * a functor of the same shape.
980
+ *
981
+ * Ramda provides suitable `map` implementations for `Array` and `Object`,
982
+ * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
983
+ *
984
+ * Dispatches to the `map` method of the second argument, if present.
985
+ *
986
+ * Acts as a transducer if a transformer is given in list position.
987
+ *
988
+ * Also treats functions as functors and will compose them together.
989
+ *
990
+ * @func
991
+ * @memberOf R
992
+ * @since v0.1.0
993
+ * @category List
994
+ * @sig Functor f => (a -> b) -> f a -> f b
995
+ * @param {Function} fn The function to be called on every element of the input `list`.
996
+ * @param {Array} list The list to be iterated over.
997
+ * @return {Array} The new list.
998
+ * @see R.transduce, R.addIndex, R.pluck, R.project
999
+ * @example
1000
+ *
1001
+ * const double = x => x * 2;
1002
+ *
1003
+ * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
1004
+ *
1005
+ * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
1006
+ * @symb R.map(f, [a, b]) = [f(a), f(b)]
1007
+ * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
1008
+ * @symb R.map(f, functor_o) = functor_o.map(f)
1009
+ */
1010
+
1011
+ var map =
1012
+ /*#__PURE__*/
1013
+ _curry2(
1014
+ /*#__PURE__*/
1015
+ _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
1016
+ switch (Object.prototype.toString.call(functor)) {
1017
+ case '[object Function]':
1018
+ return curryN(functor.length, function () {
1019
+ return fn.call(this, functor.apply(this, arguments));
1020
+ });
1021
+
1022
+ case '[object Object]':
1023
+ return _arrayReduce(function (acc, key) {
1024
+ acc[key] = fn(functor[key]);
1025
+ return acc;
1026
+ }, {}, keys(functor));
1027
+
1028
+ default:
1029
+ return _map(fn, functor);
1030
+ }
1031
+ }));
1032
+
1033
+ /**
1034
+ * Determine if the passed argument is an integer.
1035
+ *
1036
+ * @private
1037
+ * @param {*} n
1038
+ * @category Type
1039
+ * @return {Boolean}
1040
+ */
1041
+ var _isInteger = Number.isInteger || function _isInteger(n) {
1042
+ return n << 0 === n;
1043
+ };
1044
+
1045
+ function _isString(x) {
1046
+ return Object.prototype.toString.call(x) === '[object String]';
1047
+ }
1048
+
1049
+ /**
1050
+ * Returns the nth element of the given list or string. If n is negative the
1051
+ * element at index length + n is returned.
1052
+ *
1053
+ * @func
1054
+ * @memberOf R
946
1055
  * @since v0.1.0
947
1056
  * @category List
948
1057
  * @sig Number -> [a] -> a | Undefined
@@ -1037,10 +1146,109 @@ _curry2(function pluck(p, list) {
1037
1146
  return map(prop(p), list);
1038
1147
  });
1039
1148
 
1149
+ /**
1150
+ * Tests whether or not an object is similar to an array.
1151
+ *
1152
+ * @private
1153
+ * @category Type
1154
+ * @category List
1155
+ * @sig * -> Boolean
1156
+ * @param {*} x The object to test.
1157
+ * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
1158
+ * @example
1159
+ *
1160
+ * _isArrayLike([]); //=> true
1161
+ * _isArrayLike(true); //=> false
1162
+ * _isArrayLike({}); //=> false
1163
+ * _isArrayLike({length: 10}); //=> false
1164
+ * _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
1165
+ * _isArrayLike({nodeType: 1, length: 1}) // => false
1166
+ */
1167
+
1168
+ var _isArrayLike =
1169
+ /*#__PURE__*/
1170
+ _curry1(function isArrayLike(x) {
1171
+ if (_isArray$1(x)) {
1172
+ return true;
1173
+ }
1174
+
1175
+ if (!x) {
1176
+ return false;
1177
+ }
1178
+
1179
+ if (typeof x !== 'object') {
1180
+ return false;
1181
+ }
1182
+
1183
+ if (_isString(x)) {
1184
+ return false;
1185
+ }
1186
+
1187
+ if (x.length === 0) {
1188
+ return true;
1189
+ }
1190
+
1191
+ if (x.length > 0) {
1192
+ return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
1193
+ }
1194
+
1195
+ return false;
1196
+ });
1197
+
1198
+ var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
1199
+ function _createReduce(arrayReduce, methodReduce, iterableReduce) {
1200
+ return function _reduce(xf, acc, list) {
1201
+ if (_isArrayLike(list)) {
1202
+ return arrayReduce(xf, acc, list);
1203
+ }
1204
+
1205
+ if (list == null) {
1206
+ return acc;
1207
+ }
1208
+
1209
+ if (typeof list['fantasy-land/reduce'] === 'function') {
1210
+ return methodReduce(xf, acc, list, 'fantasy-land/reduce');
1211
+ }
1212
+
1213
+ if (list[symIterator] != null) {
1214
+ return iterableReduce(xf, acc, list[symIterator]());
1215
+ }
1216
+
1217
+ if (typeof list.next === 'function') {
1218
+ return iterableReduce(xf, acc, list);
1219
+ }
1220
+
1221
+ if (typeof list.reduce === 'function') {
1222
+ return methodReduce(xf, acc, list, 'reduce');
1223
+ }
1224
+
1225
+ throw new TypeError('reduce: list must be array or iterable');
1226
+ };
1227
+ }
1228
+
1229
+ function _iterableReduce(reducer, acc, iter) {
1230
+ var step = iter.next();
1231
+
1232
+ while (!step.done) {
1233
+ acc = reducer(acc, step.value);
1234
+ step = iter.next();
1235
+ }
1236
+
1237
+ return acc;
1238
+ }
1239
+
1240
+ function _methodReduce(reducer, acc, obj, methodName) {
1241
+ return obj[methodName](reducer, acc);
1242
+ }
1243
+
1244
+ var _reduce =
1245
+ /*#__PURE__*/
1246
+ _createReduce(_arrayReduce, _methodReduce, _iterableReduce);
1247
+
1040
1248
  /**
1041
1249
  * ap applies a list of functions to a list of values.
1042
1250
  *
1043
- * Dispatches to the `ap` method of the second argument, if present. Also
1251
+ * Dispatches to the `ap` method of the first argument, if present. Also
1044
1252
  * treats curried functions as applicatives.
1045
1253
  *
1046
1254
  * @func
@@ -1163,7 +1371,7 @@ _curry3(function assocPath(path, val, obj) {
1163
1371
  var idx = path[0];
1164
1372
 
1165
1373
  if (path.length > 1) {
1166
- var nextObj = !isNil(obj) && _has$1(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {};
1374
+ var nextObj = !isNil(obj) && _has$1(idx, obj) && typeof obj[idx] === 'object' ? obj[idx] : _isInteger(path[1]) ? [] : {};
1167
1375
  val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
1168
1376
  }
1169
1377
 
@@ -1221,7 +1429,7 @@ var liftN =
1221
1429
  _curry2(function liftN(arity, fn) {
1222
1430
  var lifted = curryN(arity, fn);
1223
1431
  return curryN(arity, function () {
1224
- return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
1432
+ return _arrayReduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
1225
1433
  });
1226
1434
  });
1227
1435
 
@@ -1243,47 +1451,15 @@ _curry2(function liftN(arity, fn) {
1243
1451
  *
1244
1452
  * madd3([100, 200], [30, 40], [5, 6, 7]); //=> [135, 136, 137, 145, 146, 147, 235, 236, 237, 245, 246, 247]
1245
1453
  *
1246
- * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
1247
- *
1248
- * madd5([10, 20], [1], [2, 3], [4], [100, 200]); //=> [117, 217, 118, 218, 127, 227, 128, 228]
1249
- */
1250
-
1251
- var lift =
1252
- /*#__PURE__*/
1253
- _curry1(function lift(fn) {
1254
- return liftN(fn.length, fn);
1255
- });
1256
-
1257
- /**
1258
- * Gives a single-word string description of the (native) type of a value,
1259
- * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
1260
- * attempt to distinguish user Object types any further, reporting them all as
1261
- * 'Object'.
1262
- *
1263
- * @func
1264
- * @memberOf R
1265
- * @since v0.8.0
1266
- * @category Type
1267
- * @sig (* -> {*}) -> String
1268
- * @param {*} val The value to test
1269
- * @return {String}
1270
- * @example
1454
+ * const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
1271
1455
  *
1272
- * R.type({}); //=> "Object"
1273
- * R.type(1); //=> "Number"
1274
- * R.type(false); //=> "Boolean"
1275
- * R.type('s'); //=> "String"
1276
- * R.type(null); //=> "Null"
1277
- * R.type([]); //=> "Array"
1278
- * R.type(/[A-z]/); //=> "RegExp"
1279
- * R.type(() => {}); //=> "Function"
1280
- * R.type(undefined); //=> "Undefined"
1456
+ * madd5([10, 20], [1], [2, 3], [4], [100, 200]); //=> [117, 217, 118, 218, 127, 227, 128, 228]
1281
1457
  */
1282
1458
 
1283
- var type =
1459
+ var lift =
1284
1460
  /*#__PURE__*/
1285
- _curry1(function type(val) {
1286
- return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
1461
+ _curry1(function lift(fn) {
1462
+ return liftN(fn.length, fn);
1287
1463
  });
1288
1464
 
1289
1465
  /**
@@ -1339,245 +1515,6 @@ var complement =
1339
1515
  /*#__PURE__*/
1340
1516
  lift(not);
1341
1517
 
1342
- function _arrayFromIterator(iter) {
1343
- var list = [];
1344
- var next;
1345
-
1346
- while (!(next = iter.next()).done) {
1347
- list.push(next.value);
1348
- }
1349
-
1350
- return list;
1351
- }
1352
-
1353
- function _includesWith(pred, x, list) {
1354
- var idx = 0;
1355
- var len = list.length;
1356
-
1357
- while (idx < len) {
1358
- if (pred(x, list[idx])) {
1359
- return true;
1360
- }
1361
-
1362
- idx += 1;
1363
- }
1364
-
1365
- return false;
1366
- }
1367
-
1368
- function _functionName(f) {
1369
- // String(x => x) evaluates to "x => x", so the pattern may not match.
1370
- var match = String(f).match(/^function (\w*)/);
1371
- return match == null ? '' : match[1];
1372
- }
1373
-
1374
- // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1375
- function _objectIs(a, b) {
1376
- // SameValue algorithm
1377
- if (a === b) {
1378
- // Steps 1-5, 7-10
1379
- // Steps 6.b-6.e: +0 != -0
1380
- return a !== 0 || 1 / a === 1 / b;
1381
- } else {
1382
- // Step 6.a: NaN == NaN
1383
- return a !== a && b !== b;
1384
- }
1385
- }
1386
-
1387
- var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
1388
-
1389
- /**
1390
- * private _uniqContentEquals function.
1391
- * That function is checking equality of 2 iterator contents with 2 assumptions
1392
- * - iterators lengths are the same
1393
- * - iterators values are unique
1394
- *
1395
- * false-positive result will be returned for comparison of, e.g.
1396
- * - [1,2,3] and [1,2,3,4]
1397
- * - [1,1,1] and [1,2,3]
1398
- * */
1399
-
1400
- function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
1401
- var a = _arrayFromIterator(aIterator);
1402
-
1403
- var b = _arrayFromIterator(bIterator);
1404
-
1405
- function eq(_a, _b) {
1406
- return _equals(_a, _b, stackA.slice(), stackB.slice());
1407
- } // if *a* array contains any element that is not included in *b*
1408
-
1409
-
1410
- return !_includesWith(function (b, aItem) {
1411
- return !_includesWith(eq, aItem, b);
1412
- }, b, a);
1413
- }
1414
-
1415
- function _equals(a, b, stackA, stackB) {
1416
- if (_objectIs$1(a, b)) {
1417
- return true;
1418
- }
1419
-
1420
- var typeA = type(a);
1421
-
1422
- if (typeA !== type(b)) {
1423
- return false;
1424
- }
1425
-
1426
- if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
1427
- return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
1428
- }
1429
-
1430
- if (typeof a.equals === 'function' || typeof b.equals === 'function') {
1431
- return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
1432
- }
1433
-
1434
- switch (typeA) {
1435
- case 'Arguments':
1436
- case 'Array':
1437
- case 'Object':
1438
- if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
1439
- return a === b;
1440
- }
1441
-
1442
- break;
1443
-
1444
- case 'Boolean':
1445
- case 'Number':
1446
- case 'String':
1447
- if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
1448
- return false;
1449
- }
1450
-
1451
- break;
1452
-
1453
- case 'Date':
1454
- if (!_objectIs$1(a.valueOf(), b.valueOf())) {
1455
- return false;
1456
- }
1457
-
1458
- break;
1459
-
1460
- case 'Error':
1461
- return a.name === b.name && a.message === b.message;
1462
-
1463
- case 'RegExp':
1464
- 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)) {
1465
- return false;
1466
- }
1467
-
1468
- break;
1469
- }
1470
-
1471
- var idx = stackA.length - 1;
1472
-
1473
- while (idx >= 0) {
1474
- if (stackA[idx] === a) {
1475
- return stackB[idx] === b;
1476
- }
1477
-
1478
- idx -= 1;
1479
- }
1480
-
1481
- switch (typeA) {
1482
- case 'Map':
1483
- if (a.size !== b.size) {
1484
- return false;
1485
- }
1486
-
1487
- return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
1488
-
1489
- case 'Set':
1490
- if (a.size !== b.size) {
1491
- return false;
1492
- }
1493
-
1494
- return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
1495
-
1496
- case 'Arguments':
1497
- case 'Array':
1498
- case 'Object':
1499
- case 'Boolean':
1500
- case 'Number':
1501
- case 'String':
1502
- case 'Date':
1503
- case 'Error':
1504
- case 'RegExp':
1505
- case 'Int8Array':
1506
- case 'Uint8Array':
1507
- case 'Uint8ClampedArray':
1508
- case 'Int16Array':
1509
- case 'Uint16Array':
1510
- case 'Int32Array':
1511
- case 'Uint32Array':
1512
- case 'Float32Array':
1513
- case 'Float64Array':
1514
- case 'ArrayBuffer':
1515
- break;
1516
-
1517
- default:
1518
- // Values of other types are only equal if identical.
1519
- return false;
1520
- }
1521
-
1522
- var keysA = keys(a);
1523
-
1524
- if (keysA.length !== keys(b).length) {
1525
- return false;
1526
- }
1527
-
1528
- var extendedStackA = stackA.concat([a]);
1529
- var extendedStackB = stackB.concat([b]);
1530
- idx = keysA.length - 1;
1531
-
1532
- while (idx >= 0) {
1533
- var key = keysA[idx];
1534
-
1535
- if (!(_has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
1536
- return false;
1537
- }
1538
-
1539
- idx -= 1;
1540
- }
1541
-
1542
- return true;
1543
- }
1544
-
1545
- /**
1546
- * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
1547
- * cyclical data structures.
1548
- *
1549
- * Dispatches symmetrically to the `equals` methods of both arguments, if
1550
- * present.
1551
- *
1552
- * @func
1553
- * @memberOf R
1554
- * @since v0.15.0
1555
- * @category Relation
1556
- * @sig a -> b -> Boolean
1557
- * @param {*} a
1558
- * @param {*} b
1559
- * @return {Boolean}
1560
- * @example
1561
- *
1562
- * R.equals(1, 1); //=> true
1563
- * R.equals(1, '1'); //=> false
1564
- * R.equals([1, 2, 3], [1, 2, 3]); //=> true
1565
- *
1566
- * const a = {}; a.v = a;
1567
- * const b = {}; b.v = b;
1568
- * R.equals(a, b); //=> true
1569
- */
1570
-
1571
- var equals =
1572
- /*#__PURE__*/
1573
- _curry2(function equals(a, b) {
1574
- return _equals(a, b, [], []);
1575
- });
1576
-
1577
- function _isObject$1(x) {
1578
- return Object.prototype.toString.call(x) === '[object Object]';
1579
- }
1580
-
1581
1518
  /**
1582
1519
  * Tests whether or not an object is a typed array.
1583
1520
  *