immutable 5.0.0-beta.3 → 5.0.0-beta.5

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.
Files changed (82) hide show
  1. package/README.md +4 -4
  2. package/dist/es/Collection.js +75 -0
  3. package/dist/es/CollectionImpl.js +781 -0
  4. package/dist/es/Hash.js +260 -0
  5. package/dist/es/Immutable.js +73 -0
  6. package/dist/es/Iterator.js +106 -0
  7. package/dist/es/List.js +692 -0
  8. package/dist/es/Map.js +833 -0
  9. package/dist/es/Math.js +45 -0
  10. package/dist/es/Operations.js +953 -0
  11. package/dist/es/OrderedMap.js +195 -0
  12. package/dist/es/OrderedSet.js +91 -0
  13. package/dist/es/PairSorting.js +30 -0
  14. package/dist/es/Range.js +175 -0
  15. package/dist/es/Record.js +291 -0
  16. package/dist/es/Repeat.js +130 -0
  17. package/dist/es/Seq.js +397 -0
  18. package/dist/es/Set.js +278 -0
  19. package/dist/es/Stack.js +260 -0
  20. package/dist/es/TrieUtils.js +117 -0
  21. package/dist/es/fromJS.js +74 -0
  22. package/dist/es/functional/get.js +38 -0
  23. package/dist/es/functional/getIn.js +41 -0
  24. package/dist/es/functional/has.js +35 -0
  25. package/dist/es/functional/hasIn.js +32 -0
  26. package/dist/es/functional/merge.js +137 -0
  27. package/dist/es/functional/remove.js +56 -0
  28. package/dist/es/functional/removeIn.js +32 -0
  29. package/dist/es/functional/set.js +52 -0
  30. package/dist/es/functional/setIn.js +32 -0
  31. package/dist/es/functional/update.js +31 -0
  32. package/dist/es/functional/updateIn.js +94 -0
  33. package/dist/es/is.js +108 -0
  34. package/dist/es/methods/asImmutable.js +29 -0
  35. package/dist/es/methods/asMutable.js +31 -0
  36. package/dist/es/methods/deleteIn.js +31 -0
  37. package/dist/es/methods/getIn.js +31 -0
  38. package/dist/es/methods/hasIn.js +31 -0
  39. package/dist/es/methods/merge.js +79 -0
  40. package/dist/es/methods/mergeDeep.js +41 -0
  41. package/dist/es/methods/mergeDeepIn.js +37 -0
  42. package/dist/es/methods/mergeIn.js +36 -0
  43. package/dist/es/methods/setIn.js +31 -0
  44. package/dist/es/methods/toObject.js +36 -0
  45. package/dist/es/methods/update.js +33 -0
  46. package/dist/es/methods/updateIn.js +31 -0
  47. package/dist/es/methods/wasAltered.js +29 -0
  48. package/dist/es/methods/withMutations.js +31 -0
  49. package/dist/es/package.json.js +27 -0
  50. package/dist/es/predicates/isAssociative.js +32 -0
  51. package/dist/es/predicates/isCollection.js +32 -0
  52. package/dist/es/predicates/isImmutable.js +32 -0
  53. package/dist/es/predicates/isIndexed.js +31 -0
  54. package/dist/es/predicates/isKeyed.js +31 -0
  55. package/dist/es/predicates/isList.js +31 -0
  56. package/dist/es/predicates/isMap.js +31 -0
  57. package/dist/es/predicates/isOrdered.js +31 -0
  58. package/dist/es/predicates/isOrderedMap.js +32 -0
  59. package/dist/es/predicates/isOrderedSet.js +32 -0
  60. package/dist/es/predicates/isRecord.js +31 -0
  61. package/dist/es/predicates/isSeq.js +31 -0
  62. package/dist/es/predicates/isSet.js +31 -0
  63. package/dist/es/predicates/isStack.js +31 -0
  64. package/dist/es/predicates/isValueObject.js +33 -0
  65. package/dist/es/toJS.js +54 -0
  66. package/dist/es/utils/arrCopy.js +36 -0
  67. package/dist/es/utils/assertNotInfinite.js +34 -0
  68. package/dist/es/utils/coerceKeyPath.js +40 -0
  69. package/dist/es/utils/deepEqual.js +99 -0
  70. package/dist/es/utils/hasOwnProperty.js +27 -0
  71. package/dist/es/utils/invariant.js +29 -0
  72. package/dist/es/utils/isArrayLike.js +44 -0
  73. package/dist/es/utils/isDataStructure.js +39 -0
  74. package/dist/es/utils/isPlainObj.js +52 -0
  75. package/dist/es/utils/mixin.js +38 -0
  76. package/dist/es/utils/quoteString.js +36 -0
  77. package/dist/es/utils/shallowCopy.js +41 -0
  78. package/dist/immutable.d.ts +137 -16
  79. package/dist/immutable.js +25 -68
  80. package/dist/immutable.min.js +2 -32
  81. package/package.json +2 -3
  82. package/dist/immutable.es.js +0 -5965
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
26
+
27
+ function isMap(maybeMap) {
28
+ return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
29
+ }
30
+
31
+ export { IS_MAP_SYMBOL, isMap };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
26
+
27
+ function isOrdered(maybeOrdered) {
28
+ return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
29
+ }
30
+
31
+ export { IS_ORDERED_SYMBOL, isOrdered };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import { isMap } from './isMap.js';
26
+ import { isOrdered } from './isOrdered.js';
27
+
28
+ function isOrderedMap(maybeOrderedMap) {
29
+ return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
30
+ }
31
+
32
+ export { isOrderedMap };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import { isSet } from './isSet.js';
26
+ import { isOrdered } from './isOrdered.js';
27
+
28
+ function isOrderedSet(maybeOrderedSet) {
29
+ return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
30
+ }
31
+
32
+ export { isOrderedSet };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
26
+
27
+ function isRecord(maybeRecord) {
28
+ return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
29
+ }
30
+
31
+ export { IS_RECORD_SYMBOL, isRecord };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
26
+
27
+ function isSeq(maybeSeq) {
28
+ return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
29
+ }
30
+
31
+ export { IS_SEQ_SYMBOL, isSeq };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
26
+
27
+ function isSet(maybeSet) {
28
+ return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
29
+ }
30
+
31
+ export { IS_SET_SYMBOL, isSet };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
26
+
27
+ function isStack(maybeStack) {
28
+ return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
29
+ }
30
+
31
+ export { IS_STACK_SYMBOL, isStack };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ function isValueObject(maybeValue) {
26
+ return Boolean(
27
+ maybeValue &&
28
+ typeof maybeValue.equals === 'function' &&
29
+ typeof maybeValue.hashCode === 'function'
30
+ );
31
+ }
32
+
33
+ export { isValueObject };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import { Seq } from './Seq.js';
26
+ import { isCollection } from './predicates/isCollection.js';
27
+ import { isKeyed } from './predicates/isKeyed.js';
28
+ import isDataStructure from './utils/isDataStructure.js';
29
+
30
+ function toJS(value) {
31
+ if (!value || typeof value !== 'object') {
32
+ return value;
33
+ }
34
+ if (!isCollection(value)) {
35
+ if (!isDataStructure(value)) {
36
+ return value;
37
+ }
38
+ value = Seq(value);
39
+ }
40
+ if (isKeyed(value)) {
41
+ var result$1 = {};
42
+ value.__iterate(function (v, k) {
43
+ result$1[k] = toJS(v);
44
+ });
45
+ return result$1;
46
+ }
47
+ var result = [];
48
+ value.__iterate(function (v) {
49
+ result.push(toJS(v));
50
+ });
51
+ return result;
52
+ }
53
+
54
+ export { toJS };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ // http://jsperf.com/copy-array-inline
26
+ function arrCopy(arr, offset) {
27
+ offset = offset || 0;
28
+ var len = Math.max(0, arr.length - offset);
29
+ var newArr = new Array(len);
30
+ for (var ii = 0; ii < len; ii++) {
31
+ newArr[ii] = arr[ii + offset];
32
+ }
33
+ return newArr;
34
+ }
35
+
36
+ export { arrCopy as default };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import invariant from './invariant.js';
26
+
27
+ function assertNotInfinite(size) {
28
+ invariant(
29
+ size !== Infinity,
30
+ 'Cannot perform this action with an infinite size.'
31
+ );
32
+ }
33
+
34
+ export { assertNotInfinite as default };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import { isOrdered } from '../predicates/isOrdered.js';
26
+ import isArrayLike from './isArrayLike.js';
27
+
28
+ function coerceKeyPath(keyPath) {
29
+ if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
30
+ return keyPath;
31
+ }
32
+ if (isOrdered(keyPath)) {
33
+ return keyPath.toArray();
34
+ }
35
+ throw new TypeError(
36
+ 'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
37
+ );
38
+ }
39
+
40
+ export { coerceKeyPath as default };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ import { is } from '../is.js';
26
+ import { NOT_SET } from '../TrieUtils.js';
27
+ import { isCollection } from '../predicates/isCollection.js';
28
+ import { isKeyed } from '../predicates/isKeyed.js';
29
+ import { isIndexed } from '../predicates/isIndexed.js';
30
+ import { isAssociative } from '../predicates/isAssociative.js';
31
+ import { isOrdered } from '../predicates/isOrdered.js';
32
+
33
+ function deepEqual(a, b) {
34
+ if (a === b) {
35
+ return true;
36
+ }
37
+
38
+ if (
39
+ !isCollection(b) ||
40
+ (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||
41
+ (a.__hash !== undefined &&
42
+ b.__hash !== undefined &&
43
+ a.__hash !== b.__hash) ||
44
+ isKeyed(a) !== isKeyed(b) ||
45
+ isIndexed(a) !== isIndexed(b) ||
46
+ isOrdered(a) !== isOrdered(b)
47
+ ) {
48
+ return false;
49
+ }
50
+
51
+ if (a.size === 0 && b.size === 0) {
52
+ return true;
53
+ }
54
+
55
+ var notAssociative = !isAssociative(a);
56
+
57
+ if (isOrdered(a)) {
58
+ var entries = a.entries();
59
+ return (
60
+ b.every(function (v, k) {
61
+ var entry = entries.next().value;
62
+ return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
63
+ }) && entries.next().done
64
+ );
65
+ }
66
+
67
+ var flipped = false;
68
+
69
+ if (a.size === undefined) {
70
+ if (b.size === undefined) {
71
+ if (typeof a.cacheResult === 'function') {
72
+ a.cacheResult();
73
+ }
74
+ } else {
75
+ flipped = true;
76
+ var _ = a;
77
+ a = b;
78
+ b = _;
79
+ }
80
+ }
81
+
82
+ var allEqual = true;
83
+ var bSize = b.__iterate(function (v, k) {
84
+ if (
85
+ notAssociative
86
+ ? !a.has(v)
87
+ : flipped
88
+ ? !is(v, a.get(k, NOT_SET))
89
+ : !is(a.get(k, NOT_SET), v)
90
+ ) {
91
+ allEqual = false;
92
+ return false;
93
+ }
94
+ });
95
+
96
+ return allEqual && a.size === bSize;
97
+ }
98
+
99
+ export { deepEqual as default };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
26
+
27
+ export { hasOwnProperty as default };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ function invariant(condition, error) {
26
+ if (!condition) { throw new Error(error); }
27
+ }
28
+
29
+ export { invariant as default };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * MIT License
4
+ *
5
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ function isArrayLike(value) {
26
+ if (Array.isArray(value) || typeof value === 'string') {
27
+ return true;
28
+ }
29
+
30
+ return (
31
+ value &&
32
+ typeof value === 'object' &&
33
+ Number.isInteger(value.length) &&
34
+ value.length >= 0 &&
35
+ (value.length === 0
36
+ ? // Only {length: 0} is considered Array-like.
37
+ Object.keys(value).length === 1
38
+ : // An object is only Array-like if it has a property where the last value
39
+ // in the array-like may be found (which could be undefined).
40
+ value.hasOwnProperty(value.length - 1))
41
+ );
42
+ }
43
+
44
+ export { isArrayLike as default };