immutable 5.0.0-beta.2 → 5.0.0-beta.3

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