immutable 4.3.2 → 5.0.0-beta.1

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 +11 -7
  2. package/dist/es/Collection.js +74 -0
  3. package/dist/es/CollectionImpl.js +781 -0
  4. package/dist/es/Hash.js +259 -0
  5. package/dist/es/Immutable.js +73 -0
  6. package/dist/es/Iterator.js +105 -0
  7. package/dist/es/List.js +691 -0
  8. package/dist/es/Map.js +832 -0
  9. package/dist/es/Math.js +44 -0
  10. package/dist/es/Operations.js +952 -0
  11. package/dist/es/OrderedMap.js +194 -0
  12. package/dist/es/OrderedSet.js +90 -0
  13. package/dist/es/PairSorting.js +29 -0
  14. package/dist/es/Range.js +167 -0
  15. package/dist/es/Record.js +290 -0
  16. package/dist/es/Repeat.js +129 -0
  17. package/dist/es/Seq.js +396 -0
  18. package/dist/es/Set.js +277 -0
  19. package/dist/es/Stack.js +259 -0
  20. package/dist/es/TrieUtils.js +115 -0
  21. package/dist/es/fromJS.js +73 -0
  22. package/dist/es/functional/get.js +37 -0
  23. package/dist/es/functional/getIn.js +40 -0
  24. package/dist/es/functional/has.js +34 -0
  25. package/dist/es/functional/hasIn.js +31 -0
  26. package/dist/es/functional/merge.js +136 -0
  27. package/dist/es/functional/remove.js +55 -0
  28. package/dist/es/functional/removeIn.js +31 -0
  29. package/dist/es/functional/set.js +51 -0
  30. package/dist/es/functional/setIn.js +31 -0
  31. package/dist/es/functional/update.js +30 -0
  32. package/dist/es/functional/updateIn.js +93 -0
  33. package/dist/es/is.js +107 -0
  34. package/dist/es/methods/asImmutable.js +28 -0
  35. package/dist/es/methods/asMutable.js +30 -0
  36. package/dist/es/methods/deleteIn.js +30 -0
  37. package/dist/es/methods/getIn.js +30 -0
  38. package/dist/es/methods/hasIn.js +30 -0
  39. package/dist/es/methods/merge.js +78 -0
  40. package/dist/es/methods/mergeDeep.js +40 -0
  41. package/dist/es/methods/mergeDeepIn.js +36 -0
  42. package/dist/es/methods/mergeIn.js +35 -0
  43. package/dist/es/methods/setIn.js +30 -0
  44. package/dist/es/methods/toObject.js +35 -0
  45. package/dist/es/methods/update.js +32 -0
  46. package/dist/es/methods/updateIn.js +30 -0
  47. package/dist/es/methods/wasAltered.js +28 -0
  48. package/dist/es/methods/withMutations.js +30 -0
  49. package/dist/es/package.json.js +26 -0
  50. package/dist/es/predicates/isAssociative.js +31 -0
  51. package/dist/es/predicates/isCollection.js +30 -0
  52. package/dist/es/predicates/isImmutable.js +31 -0
  53. package/dist/es/predicates/isIndexed.js +30 -0
  54. package/dist/es/predicates/isKeyed.js +30 -0
  55. package/dist/es/predicates/isList.js +30 -0
  56. package/dist/es/predicates/isMap.js +30 -0
  57. package/dist/es/predicates/isOrdered.js +30 -0
  58. package/dist/es/predicates/isOrderedMap.js +31 -0
  59. package/dist/es/predicates/isOrderedSet.js +31 -0
  60. package/dist/es/predicates/isRecord.js +30 -0
  61. package/dist/es/predicates/isSeq.js +30 -0
  62. package/dist/es/predicates/isSet.js +30 -0
  63. package/dist/es/predicates/isStack.js +30 -0
  64. package/dist/es/predicates/isValueObject.js +32 -0
  65. package/dist/es/toJS.js +53 -0
  66. package/dist/es/utils/arrCopy.js +34 -0
  67. package/dist/es/utils/assertNotInfinite.js +33 -0
  68. package/dist/es/utils/coerceKeyPath.js +39 -0
  69. package/dist/es/utils/deepEqual.js +98 -0
  70. package/dist/es/utils/hasOwnProperty.js +26 -0
  71. package/dist/es/utils/invariant.js +28 -0
  72. package/dist/es/utils/isArrayLike.js +43 -0
  73. package/dist/es/utils/isDataStructure.js +38 -0
  74. package/dist/es/utils/isPlainObj.js +51 -0
  75. package/dist/es/utils/mixin.js +34 -0
  76. package/dist/es/utils/quoteString.js +32 -0
  77. package/dist/es/utils/shallowCopy.js +40 -0
  78. package/dist/immutable.d.ts +136 -21
  79. package/dist/immutable.js +1 -59
  80. package/dist/immutable.min.js +32 -32
  81. package/package.json +5 -3
  82. package/dist/immutable.es.js +0 -5965
package/README.md CHANGED
@@ -58,13 +58,17 @@ Want to hear more? Watch the presentation about Immutable.js:
58
58
  Install `immutable` using npm.
59
59
 
60
60
  ```shell
61
+ # using npm
61
62
  npm install immutable
62
- ```
63
-
64
- Or install using yarn.
65
63
 
66
- ```shell
64
+ # using Yarn
67
65
  yarn add immutable
66
+
67
+ # using pnpm
68
+ pnpm add immutable
69
+
70
+ # using Bun
71
+ bun add immutable
68
72
  ```
69
73
 
70
74
  Then require it into any module.
@@ -148,9 +152,9 @@ via relative path to the type definitions at the top of your file.
148
152
 
149
153
  ```js
150
154
  ///<reference path='./node_modules/immutable/dist/immutable.d.ts'/>
151
- import Immutable from 'immutable';
152
- var map1: Immutable.Map<string, number>;
153
- map1 = Immutable.Map({ a: 1, b: 2, c: 3 });
155
+ import { Map } from 'immutable';
156
+ var map1: Map<string, number>;
157
+ map1 = Map({ a: 1, b: 2, c: 3 });
154
158
  var map2 = map1.set('b', 50);
155
159
  map1.get('b'); // 2
156
160
  map2.get('b'); // 50
@@ -0,0 +1,74 @@
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, IndexedSeq, KeyedSeq, SetSeq } from './Seq.js';
25
+ import { isCollection } from './predicates/isCollection.js';
26
+ import { isKeyed } from './predicates/isKeyed.js';
27
+ import { isIndexed } from './predicates/isIndexed.js';
28
+ import { isAssociative } from './predicates/isAssociative.js';
29
+
30
+ var Collection = function Collection(value) {
31
+ return isCollection(value) ? value : Seq(value);
32
+ };
33
+
34
+ var KeyedCollection = /*@__PURE__*/(function (Collection) {
35
+ function KeyedCollection(value) {
36
+ return isKeyed(value) ? value : KeyedSeq(value);
37
+ }
38
+
39
+ if ( Collection ) KeyedCollection.__proto__ = Collection;
40
+ KeyedCollection.prototype = Object.create( Collection && Collection.prototype );
41
+ KeyedCollection.prototype.constructor = KeyedCollection;
42
+
43
+ return KeyedCollection;
44
+ }(Collection));
45
+
46
+ var IndexedCollection = /*@__PURE__*/(function (Collection) {
47
+ function IndexedCollection(value) {
48
+ return isIndexed(value) ? value : IndexedSeq(value);
49
+ }
50
+
51
+ if ( Collection ) IndexedCollection.__proto__ = Collection;
52
+ IndexedCollection.prototype = Object.create( Collection && Collection.prototype );
53
+ IndexedCollection.prototype.constructor = IndexedCollection;
54
+
55
+ return IndexedCollection;
56
+ }(Collection));
57
+
58
+ var SetCollection = /*@__PURE__*/(function (Collection) {
59
+ function SetCollection(value) {
60
+ return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
61
+ }
62
+
63
+ if ( Collection ) SetCollection.__proto__ = Collection;
64
+ SetCollection.prototype = Object.create( Collection && Collection.prototype );
65
+ SetCollection.prototype.constructor = SetCollection;
66
+
67
+ return SetCollection;
68
+ }(Collection));
69
+
70
+ Collection.Keyed = KeyedCollection;
71
+ Collection.Indexed = IndexedCollection;
72
+ Collection.Set = SetCollection;
73
+
74
+ export { Collection, IndexedCollection, KeyedCollection, SetCollection };