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