@pie-element/ebsr 6.6.3-next.400 → 6.6.3-next.411

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 (146) hide show
  1. package/package.json +2 -2
  2. package/configure/node_modules/immutable/LICENSE +0 -21
  3. package/configure/node_modules/immutable/README.md +0 -657
  4. package/configure/node_modules/immutable/dist/immutable-nonambient.d.ts +0 -5607
  5. package/configure/node_modules/immutable/dist/immutable.d.ts +0 -5611
  6. package/configure/node_modules/immutable/dist/immutable.es.js +0 -5893
  7. package/configure/node_modules/immutable/dist/immutable.js +0 -5948
  8. package/configure/node_modules/immutable/dist/immutable.js.flow +0 -2340
  9. package/configure/node_modules/immutable/dist/immutable.min.js +0 -55
  10. package/configure/node_modules/immutable/package.json +0 -41
  11. package/configure/node_modules/slate-edit-list/CHANGELOG.md +0 -124
  12. package/configure/node_modules/slate-edit-list/LICENSE +0 -201
  13. package/configure/node_modules/slate-edit-list/README.md +0 -159
  14. package/configure/node_modules/slate-edit-list/dist/changes/decreaseItemDepth.js +0 -73
  15. package/configure/node_modules/slate-edit-list/dist/changes/decreaseItemDepth.js.flow +0 -88
  16. package/configure/node_modules/slate-edit-list/dist/changes/increaseItemDepth.js +0 -70
  17. package/configure/node_modules/slate-edit-list/dist/changes/increaseItemDepth.js.flow +0 -77
  18. package/configure/node_modules/slate-edit-list/dist/changes/index.js +0 -34
  19. package/configure/node_modules/slate-edit-list/dist/changes/index.js.flow +0 -13
  20. package/configure/node_modules/slate-edit-list/dist/changes/splitListItem.js +0 -27
  21. package/configure/node_modules/slate-edit-list/dist/changes/splitListItem.js.flow +0 -26
  22. package/configure/node_modules/slate-edit-list/dist/changes/unwrapList.js +0 -52
  23. package/configure/node_modules/slate-edit-list/dist/changes/unwrapList.js.flow +0 -46
  24. package/configure/node_modules/slate-edit-list/dist/changes/wrapInList.js +0 -67
  25. package/configure/node_modules/slate-edit-list/dist/changes/wrapInList.js.flow +0 -67
  26. package/configure/node_modules/slate-edit-list/dist/core.js +0 -80
  27. package/configure/node_modules/slate-edit-list/dist/core.js.flow +0 -76
  28. package/configure/node_modules/slate-edit-list/dist/handlers/index.js +0 -24
  29. package/configure/node_modules/slate-edit-list/dist/handlers/index.js.flow +0 -5
  30. package/configure/node_modules/slate-edit-list/dist/handlers/onBackspace.js +0 -45
  31. package/configure/node_modules/slate-edit-list/dist/handlers/onBackspace.js.flow +0 -44
  32. package/configure/node_modules/slate-edit-list/dist/handlers/onEnter.js +0 -54
  33. package/configure/node_modules/slate-edit-list/dist/handlers/onEnter.js.flow +0 -54
  34. package/configure/node_modules/slate-edit-list/dist/handlers/onTab.js +0 -39
  35. package/configure/node_modules/slate-edit-list/dist/handlers/onTab.js.flow +0 -34
  36. package/configure/node_modules/slate-edit-list/dist/index.js +0 -58
  37. package/configure/node_modules/slate-edit-list/dist/index.js.flow +0 -45
  38. package/configure/node_modules/slate-edit-list/dist/options.js +0 -34
  39. package/configure/node_modules/slate-edit-list/dist/options.js.flow +0 -26
  40. package/configure/node_modules/slate-edit-list/dist/utils/getCurrentItem.js +0 -24
  41. package/configure/node_modules/slate-edit-list/dist/utils/getCurrentItem.js.flow +0 -20
  42. package/configure/node_modules/slate-edit-list/dist/utils/getCurrentList.js +0 -31
  43. package/configure/node_modules/slate-edit-list/dist/utils/getCurrentList.js.flow +0 -21
  44. package/configure/node_modules/slate-edit-list/dist/utils/getItemDepth.js +0 -34
  45. package/configure/node_modules/slate-edit-list/dist/utils/getItemDepth.js.flow +0 -24
  46. package/configure/node_modules/slate-edit-list/dist/utils/getItemsAtRange.js +0 -60
  47. package/configure/node_modules/slate-edit-list/dist/utils/getItemsAtRange.js.flow +0 -51
  48. package/configure/node_modules/slate-edit-list/dist/utils/getListForItem.js +0 -25
  49. package/configure/node_modules/slate-edit-list/dist/utils/getListForItem.js.flow +0 -16
  50. package/configure/node_modules/slate-edit-list/dist/utils/getPreviousItem.js +0 -39
  51. package/configure/node_modules/slate-edit-list/dist/utils/getPreviousItem.js.flow +0 -29
  52. package/configure/node_modules/slate-edit-list/dist/utils/index.js +0 -49
  53. package/configure/node_modules/slate-edit-list/dist/utils/index.js.flow +0 -19
  54. package/configure/node_modules/slate-edit-list/dist/utils/isList.js +0 -15
  55. package/configure/node_modules/slate-edit-list/dist/utils/isList.js.flow +0 -13
  56. package/configure/node_modules/slate-edit-list/dist/utils/isSelectionInList.js +0 -22
  57. package/configure/node_modules/slate-edit-list/dist/utils/isSelectionInList.js.flow +0 -14
  58. package/configure/node_modules/slate-edit-list/dist/validation/index.js +0 -19
  59. package/configure/node_modules/slate-edit-list/dist/validation/index.js.flow +0 -4
  60. package/configure/node_modules/slate-edit-list/dist/validation/schema.js +0 -83
  61. package/configure/node_modules/slate-edit-list/dist/validation/schema.js.flow +0 -81
  62. package/configure/node_modules/slate-edit-list/dist/validation/validateNode.js +0 -61
  63. package/configure/node_modules/slate-edit-list/dist/validation/validateNode.js.flow +0 -61
  64. package/configure/node_modules/slate-edit-list/package.json +0 -67
  65. package/configure/node_modules/slate-edit-table/CHANGELOG.md +0 -192
  66. package/configure/node_modules/slate-edit-table/LICENSE +0 -201
  67. package/configure/node_modules/slate-edit-table/README.md +0 -269
  68. package/configure/node_modules/slate-edit-table/dist/changes/clearCell.js +0 -29
  69. package/configure/node_modules/slate-edit-table/dist/changes/clearCell.js.flow +0 -26
  70. package/configure/node_modules/slate-edit-table/dist/changes/index.js +0 -69
  71. package/configure/node_modules/slate-edit-table/dist/changes/index.js.flow +0 -27
  72. package/configure/node_modules/slate-edit-table/dist/changes/insertColumn.js +0 -43
  73. package/configure/node_modules/slate-edit-table/dist/changes/insertColumn.js.flow +0 -46
  74. package/configure/node_modules/slate-edit-table/dist/changes/insertRow.js +0 -36
  75. package/configure/node_modules/slate-edit-table/dist/changes/insertRow.js.flow +0 -35
  76. package/configure/node_modules/slate-edit-table/dist/changes/insertTable.js +0 -29
  77. package/configure/node_modules/slate-edit-table/dist/changes/insertTable.js.flow +0 -27
  78. package/configure/node_modules/slate-edit-table/dist/changes/moveSelection.js +0 -32
  79. package/configure/node_modules/slate-edit-table/dist/changes/moveSelection.js.flow +0 -31
  80. package/configure/node_modules/slate-edit-table/dist/changes/moveSelectionBy.js +0 -84
  81. package/configure/node_modules/slate-edit-table/dist/changes/moveSelectionBy.js.flow +0 -80
  82. package/configure/node_modules/slate-edit-table/dist/changes/removeColumn.js +0 -36
  83. package/configure/node_modules/slate-edit-table/dist/changes/removeColumn.js.flow +0 -28
  84. package/configure/node_modules/slate-edit-table/dist/changes/removeColumnByKey.js +0 -52
  85. package/configure/node_modules/slate-edit-table/dist/changes/removeColumnByKey.js.flow +0 -40
  86. package/configure/node_modules/slate-edit-table/dist/changes/removeRow.js +0 -36
  87. package/configure/node_modules/slate-edit-table/dist/changes/removeRow.js.flow +0 -27
  88. package/configure/node_modules/slate-edit-table/dist/changes/removeRowByKey.js +0 -41
  89. package/configure/node_modules/slate-edit-table/dist/changes/removeRowByKey.js.flow +0 -30
  90. package/configure/node_modules/slate-edit-table/dist/changes/removeTable.js +0 -26
  91. package/configure/node_modules/slate-edit-table/dist/changes/removeTable.js.flow +0 -17
  92. package/configure/node_modules/slate-edit-table/dist/changes/removeTableByKey.js +0 -56
  93. package/configure/node_modules/slate-edit-table/dist/changes/removeTableByKey.js.flow +0 -54
  94. package/configure/node_modules/slate-edit-table/dist/core.js +0 -88
  95. package/configure/node_modules/slate-edit-table/dist/core.js.flow +0 -94
  96. package/configure/node_modules/slate-edit-table/dist/handlers/index.js +0 -39
  97. package/configure/node_modules/slate-edit-table/dist/handlers/index.js.flow +0 -8
  98. package/configure/node_modules/slate-edit-table/dist/handlers/onBackspace.js +0 -82
  99. package/configure/node_modules/slate-edit-table/dist/handlers/onBackspace.js.flow +0 -87
  100. package/configure/node_modules/slate-edit-table/dist/handlers/onEnter.js +0 -34
  101. package/configure/node_modules/slate-edit-table/dist/handlers/onEnter.js.flow +0 -37
  102. package/configure/node_modules/slate-edit-table/dist/handlers/onKeyDown.js +0 -71
  103. package/configure/node_modules/slate-edit-table/dist/handlers/onKeyDown.js.flow +0 -56
  104. package/configure/node_modules/slate-edit-table/dist/handlers/onModEnter.js +0 -35
  105. package/configure/node_modules/slate-edit-table/dist/handlers/onModEnter.js.flow +0 -38
  106. package/configure/node_modules/slate-edit-table/dist/handlers/onTab.js +0 -56
  107. package/configure/node_modules/slate-edit-table/dist/handlers/onTab.js.flow +0 -51
  108. package/configure/node_modules/slate-edit-table/dist/handlers/onUpDown.js +0 -38
  109. package/configure/node_modules/slate-edit-table/dist/handlers/onUpDown.js.flow +0 -41
  110. package/configure/node_modules/slate-edit-table/dist/index.js +0 -36
  111. package/configure/node_modules/slate-edit-table/dist/index.js.flow +0 -27
  112. package/configure/node_modules/slate-edit-table/dist/options.js +0 -61
  113. package/configure/node_modules/slate-edit-table/dist/options.js.flow +0 -42
  114. package/configure/node_modules/slate-edit-table/dist/utils/TablePosition.js +0 -306
  115. package/configure/node_modules/slate-edit-table/dist/utils/TablePosition.js.flow +0 -211
  116. package/configure/node_modules/slate-edit-table/dist/utils/createCell.js +0 -30
  117. package/configure/node_modules/slate-edit-table/dist/utils/createCell.js.flow +0 -26
  118. package/configure/node_modules/slate-edit-table/dist/utils/createRow.js +0 -30
  119. package/configure/node_modules/slate-edit-table/dist/utils/createRow.js.flow +0 -28
  120. package/configure/node_modules/slate-edit-table/dist/utils/createTable.js +0 -30
  121. package/configure/node_modules/slate-edit-table/dist/utils/createTable.js.flow +0 -33
  122. package/configure/node_modules/slate-edit-table/dist/utils/forEachCells.js +0 -21
  123. package/configure/node_modules/slate-edit-table/dist/utils/forEachCells.js.flow +0 -22
  124. package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtColumn.js +0 -22
  125. package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtColumn.js.flow +0 -19
  126. package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtRow.js +0 -20
  127. package/configure/node_modules/slate-edit-table/dist/utils/getCellsAtRow.js.flow +0 -19
  128. package/configure/node_modules/slate-edit-table/dist/utils/getPosition.js +0 -24
  129. package/configure/node_modules/slate-edit-table/dist/utils/getPosition.js.flow +0 -19
  130. package/configure/node_modules/slate-edit-table/dist/utils/getPositionByKey.js +0 -26
  131. package/configure/node_modules/slate-edit-table/dist/utils/getPositionByKey.js.flow +0 -21
  132. package/configure/node_modules/slate-edit-table/dist/utils/getRow.js +0 -24
  133. package/configure/node_modules/slate-edit-table/dist/utils/getRow.js.flow +0 -19
  134. package/configure/node_modules/slate-edit-table/dist/utils/index.js +0 -64
  135. package/configure/node_modules/slate-edit-table/dist/utils/index.js.flow +0 -25
  136. package/configure/node_modules/slate-edit-table/dist/utils/isSelectionInTable.js +0 -34
  137. package/configure/node_modules/slate-edit-table/dist/utils/isSelectionInTable.js.flow +0 -27
  138. package/configure/node_modules/slate-edit-table/dist/utils/isSelectionOutOfTable.js +0 -30
  139. package/configure/node_modules/slate-edit-table/dist/utils/isSelectionOutOfTable.js.flow +0 -23
  140. package/configure/node_modules/slate-edit-table/dist/validation/index.js +0 -19
  141. package/configure/node_modules/slate-edit-table/dist/validation/index.js.flow +0 -4
  142. package/configure/node_modules/slate-edit-table/dist/validation/schema.js +0 -101
  143. package/configure/node_modules/slate-edit-table/dist/validation/schema.js.flow +0 -98
  144. package/configure/node_modules/slate-edit-table/dist/validation/validateNode.js +0 -56
  145. package/configure/node_modules/slate-edit-table/dist/validation/validateNode.js.flow +0 -49
  146. package/configure/node_modules/slate-edit-table/package.json +0 -69
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/ebsr",
3
- "version": "6.6.3-next.400+5ffa2faae",
3
+ "version": "6.6.3-next.411+580d11f34",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "author": "pie framework developers",
17
17
  "license": "ISC",
18
- "gitHead": "5ffa2faaef5a1e06148fae1df1c7fb75dd4f14b0",
18
+ "gitHead": "580d11f344b828ddec44b9ba301140647d441af9",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2014-present, Lee Byron and other contributors.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,657 +0,0 @@
1
- # Immutable collections for JavaScript
2
-
3
- [![Build Status](https://github.com/immutable-js/immutable-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/immutable-js/immutable-js/actions/workflows/ci.yml?query=branch%3Amain) [Chat on slack](https://immutable-js.slack.com)
4
-
5
- [Immutable][] data cannot be changed once created, leading to much simpler
6
- application development, no defensive copying, and enabling advanced memoization
7
- and change detection techniques with simple logic. [Persistent][] data presents
8
- a mutative API which does not update the data in-place, but instead always
9
- yields new updated data.
10
-
11
- Immutable.js provides many Persistent Immutable data structures including:
12
- `List`, `Stack`, `Map`, `OrderedMap`, `Set`, `OrderedSet` and `Record`.
13
-
14
- These data structures are highly efficient on modern JavaScript VMs by using
15
- structural sharing via [hash maps tries][] and [vector tries][] as popularized
16
- by Clojure and Scala, minimizing the need to copy or cache data.
17
-
18
- Immutable.js also provides a lazy `Seq`, allowing efficient
19
- chaining of collection methods like `map` and `filter` without creating
20
- intermediate representations. Create some `Seq` with `Range` and `Repeat`.
21
-
22
- Want to hear more? Watch the presentation about Immutable.js:
23
-
24
- [![Immutable Data and React](website/public/Immutable-Data-and-React-YouTube.png)](https://youtu.be/I7IdS-PbEgI)
25
-
26
- [Persistent]: https://en.wikipedia.org/wiki/Persistent_data_structure
27
- [Immutable]: https://en.wikipedia.org/wiki/Immutable_object
28
- [hash maps tries]: https://en.wikipedia.org/wiki/Hash_array_mapped_trie
29
- [vector tries]: https://hypirion.com/musings/understanding-persistent-vector-pt-1
30
-
31
- ## Getting started
32
-
33
- Install `immutable` using npm.
34
-
35
- ```shell
36
- npm install immutable
37
- ```
38
-
39
- Or install using yarn.
40
-
41
- ```shell
42
- yarn add immutable
43
- ```
44
-
45
- Then require it into any module.
46
-
47
- <!-- runkit:activate -->
48
-
49
- ```js
50
- const { Map } = require('immutable');
51
- const map1 = Map({ a: 1, b: 2, c: 3 });
52
- const map2 = map1.set('b', 50);
53
- map1.get('b') + ' vs. ' + map2.get('b'); // 2 vs. 50
54
- ```
55
-
56
- ### Browser
57
-
58
- Immutable.js has no dependencies, which makes it predictable to include in a Browser.
59
-
60
- It's highly recommended to use a module bundler like [webpack](https://webpack.github.io/),
61
- [rollup](https://rollupjs.org/), or
62
- [browserify](https://browserify.org/). The `immutable` npm module works
63
- without any additional consideration. All examples throughout the documentation
64
- will assume use of this kind of tool.
65
-
66
- Alternatively, Immutable.js may be directly included as a script tag. Download
67
- or link to a CDN such as [CDNJS](https://cdnjs.com/libraries/immutable)
68
- or [jsDelivr](https://www.jsdelivr.com/package/npm/immutable).
69
-
70
- Use a script tag to directly add `Immutable` to the global scope:
71
-
72
- ```html
73
- <script src="immutable.min.js"></script>
74
- <script>
75
- var map1 = Immutable.Map({ a: 1, b: 2, c: 3 });
76
- var map2 = map1.set('b', 50);
77
- map1.get('b'); // 2
78
- map2.get('b'); // 50
79
- </script>
80
- ```
81
-
82
- Or use an AMD-style loader (such as [RequireJS](https://requirejs.org/)):
83
-
84
- ```js
85
- require(['./immutable.min.js'], function (Immutable) {
86
- var map1 = Immutable.Map({ a: 1, b: 2, c: 3 });
87
- var map2 = map1.set('b', 50);
88
- map1.get('b'); // 2
89
- map2.get('b'); // 50
90
- });
91
- ```
92
-
93
- ### Flow & TypeScript
94
-
95
- Use these Immutable collections and sequences as you would use native
96
- collections in your [Flowtype](https://flowtype.org/) or [TypeScript](https://typescriptlang.org) programs while still taking
97
- advantage of type generics, error detection, and auto-complete in your IDE.
98
-
99
- Installing `immutable` via npm brings with it type definitions for Flow (v0.55.0 or higher)
100
- and TypeScript (v2.1.0 or higher), so you shouldn't need to do anything at all!
101
-
102
- #### Using TypeScript with Immutable.js v4
103
-
104
- Immutable.js type definitions embrace ES2015. While Immutable.js itself supports
105
- legacy browsers and environments, its type definitions require TypeScript's 2015
106
- lib. Include either `"target": "es2015"` or `"lib": "es2015"` in your
107
- `tsconfig.json`, or provide `--target es2015` or `--lib es2015` to the
108
- `tsc` command.
109
-
110
- <!-- runkit:activate -->
111
-
112
- ```js
113
- const { Map } = require('immutable');
114
- const map1 = Map({ a: 1, b: 2, c: 3 });
115
- const map2 = map1.set('b', 50);
116
- map1.get('b') + ' vs. ' + map2.get('b'); // 2 vs. 50
117
- ```
118
-
119
- #### Using TypeScript with Immutable.js v3 and earlier:
120
-
121
- Previous versions of Immutable.js include a reference file which you can include
122
- via relative path to the type definitions at the top of your file.
123
-
124
- ```js
125
- ///<reference path='./node_modules/immutable/dist/immutable.d.ts'/>
126
- import Immutable from require('immutable');
127
- var map1: Immutable.Map<string, number>;
128
- map1 = Immutable.Map({ a: 1, b: 2, c: 3 });
129
- var map2 = map1.set('b', 50);
130
- map1.get('b'); // 2
131
- map2.get('b'); // 50
132
- ```
133
-
134
- ## The case for Immutability
135
-
136
- Much of what makes application development difficult is tracking mutation and
137
- maintaining state. Developing with immutable data encourages you to think
138
- differently about how data flows through your application.
139
-
140
- Subscribing to data events throughout your application creates a huge overhead of
141
- book-keeping which can hurt performance, sometimes dramatically, and creates
142
- opportunities for areas of your application to get out of sync with each other
143
- due to easy to make programmer error. Since immutable data never changes,
144
- subscribing to changes throughout the model is a dead-end and new data can only
145
- ever be passed from above.
146
-
147
- This model of data flow aligns well with the architecture of [React][]
148
- and especially well with an application designed using the ideas of [Flux][].
149
-
150
- When data is passed from above rather than being subscribed to, and you're only
151
- interested in doing work when something has changed, you can use equality.
152
-
153
- Immutable collections should be treated as _values_ rather than _objects_. While
154
- objects represent some thing which could change over time, a value represents
155
- the state of that thing at a particular instance of time. This principle is most
156
- important to understanding the appropriate use of immutable data. In order to
157
- treat Immutable.js collections as values, it's important to use the
158
- `Immutable.is()` function or `.equals()` method to determine _value equality_
159
- instead of the `===` operator which determines object _reference identity_.
160
-
161
- <!-- runkit:activate -->
162
-
163
- ```js
164
- const { Map } = require('immutable');
165
- const map1 = Map({ a: 1, b: 2, c: 3 });
166
- const map2 = Map({ a: 1, b: 2, c: 3 });
167
- map1.equals(map2); // true
168
- map1 === map2; // false
169
- ```
170
-
171
- Note: As a performance optimization Immutable.js attempts to return the existing
172
- collection when an operation would result in an identical collection, allowing
173
- for using `===` reference equality to determine if something definitely has not
174
- changed. This can be extremely useful when used within a memoization function
175
- which would prefer to re-run the function if a deeper equality check could
176
- potentially be more costly. The `===` equality check is also used internally by
177
- `Immutable.is` and `.equals()` as a performance optimization.
178
-
179
- <!-- runkit:activate -->
180
-
181
- ```js
182
- const { Map } = require('immutable');
183
- const map1 = Map({ a: 1, b: 2, c: 3 });
184
- const map2 = map1.set('b', 2); // Set to same value
185
- map1 === map2; // true
186
- ```
187
-
188
- If an object is immutable, it can be "copied" simply by making another reference
189
- to it instead of copying the entire object. Because a reference is much smaller
190
- than the object itself, this results in memory savings and a potential boost in
191
- execution speed for programs which rely on copies (such as an undo-stack).
192
-
193
- <!-- runkit:activate -->
194
-
195
- ```js
196
- const { Map } = require('immutable');
197
- const map = Map({ a: 1, b: 2, c: 3 });
198
- const mapCopy = map; // Look, "copies" are free!
199
- ```
200
-
201
- [React]: https://reactjs.org/
202
- [Flux]: https://facebook.github.io/flux/docs/in-depth-overview/
203
-
204
-
205
- ## JavaScript-first API
206
-
207
- While Immutable.js is inspired by Clojure, Scala, Haskell and other functional
208
- programming environments, it's designed to bring these powerful concepts to
209
- JavaScript, and therefore has an Object-Oriented API that closely mirrors that
210
- of [ES2015][] [Array][], [Map][], and [Set][].
211
-
212
- [es2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla
213
- [array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
214
- [map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
215
- [set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
216
-
217
- The difference for the immutable collections is that methods which would mutate
218
- the collection, like `push`, `set`, `unshift` or `splice`, instead return a new
219
- immutable collection. Methods which return new arrays, like `slice` or `concat`,
220
- instead return new immutable collections.
221
-
222
- <!-- runkit:activate -->
223
-
224
- ```js
225
- const { List } = require('immutable');
226
- const list1 = List([1, 2]);
227
- const list2 = list1.push(3, 4, 5);
228
- const list3 = list2.unshift(0);
229
- const list4 = list1.concat(list2, list3);
230
- assert.equal(list1.size, 2);
231
- assert.equal(list2.size, 5);
232
- assert.equal(list3.size, 6);
233
- assert.equal(list4.size, 13);
234
- assert.equal(list4.get(0), 1);
235
- ```
236
-
237
- Almost all of the methods on [Array][] will be found in similar form on
238
- `Immutable.List`, those of [Map][] found on `Immutable.Map`, and those of [Set][]
239
- found on `Immutable.Set`, including collection operations like `forEach()`
240
- and `map()`.
241
-
242
- <!-- runkit:activate -->
243
-
244
- ```js
245
- const { Map } = require('immutable');
246
- const alpha = Map({ a: 1, b: 2, c: 3, d: 4 });
247
- alpha.map((v, k) => k.toUpperCase()).join();
248
- // 'A,B,C,D'
249
- ```
250
-
251
- ### Convert from raw JavaScript objects and arrays.
252
-
253
- Designed to inter-operate with your existing JavaScript, Immutable.js
254
- accepts plain JavaScript Arrays and Objects anywhere a method expects a
255
- `Collection`.
256
-
257
- <!-- runkit:activate -->
258
-
259
- ```js
260
- const { Map, List } = require('immutable');
261
- const map1 = Map({ a: 1, b: 2, c: 3, d: 4 });
262
- const map2 = Map({ c: 10, a: 20, t: 30 });
263
- const obj = { d: 100, o: 200, g: 300 };
264
- const map3 = map1.merge(map2, obj);
265
- // Map { a: 20, b: 2, c: 10, d: 100, t: 30, o: 200, g: 300 }
266
- const list1 = List([1, 2, 3]);
267
- const list2 = List([4, 5, 6]);
268
- const array = [7, 8, 9];
269
- const list3 = list1.concat(list2, array);
270
- // List [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
271
- ```
272
-
273
- This is possible because Immutable.js can treat any JavaScript Array or Object
274
- as a Collection. You can take advantage of this in order to get sophisticated
275
- collection methods on JavaScript Objects, which otherwise have a very sparse
276
- native API. Because Seq evaluates lazily and does not cache intermediate
277
- results, these operations can be extremely efficient.
278
-
279
- <!-- runkit:activate -->
280
-
281
- ```js
282
- const { Seq } = require('immutable');
283
- const myObject = { a: 1, b: 2, c: 3 };
284
- Seq(myObject)
285
- .map(x => x * x)
286
- .toObject();
287
- // { a: 1, b: 4, c: 9 }
288
- ```
289
-
290
- Keep in mind, when using JS objects to construct Immutable Maps, that
291
- JavaScript Object properties are always strings, even if written in a quote-less
292
- shorthand, while Immutable Maps accept keys of any type.
293
-
294
- <!-- runkit:activate -->
295
-
296
- ```js
297
- const { fromJS } = require('immutable');
298
-
299
- const obj = { 1: 'one' };
300
- console.log(Object.keys(obj)); // [ "1" ]
301
- console.log(obj['1'], obj[1]); // "one", "one"
302
-
303
- const map = fromJS(obj);
304
- console.log(map.get('1'), map.get(1)); // "one", undefined
305
- ```
306
-
307
- Property access for JavaScript Objects first converts the key to a string, but
308
- since Immutable Map keys can be of any type the argument to `get()` is
309
- not altered.
310
-
311
- ### Converts back to raw JavaScript objects.
312
-
313
- All Immutable.js Collections can be converted to plain JavaScript Arrays and
314
- Objects shallowly with `toArray()` and `toObject()` or deeply with `toJS()`.
315
- All Immutable Collections also implement `toJSON()` allowing them to be passed
316
- to `JSON.stringify` directly. They also respect the custom `toJSON()` methods of
317
- nested objects.
318
-
319
- <!-- runkit:activate -->
320
-
321
- ```js
322
- const { Map, List } = require('immutable');
323
- const deep = Map({ a: 1, b: 2, c: List([3, 4, 5]) });
324
- console.log(deep.toObject()); // { a: 1, b: 2, c: List [ 3, 4, 5 ] }
325
- console.log(deep.toArray()); // [ 1, 2, List [ 3, 4, 5 ] ]
326
- console.log(deep.toJS()); // { a: 1, b: 2, c: [ 3, 4, 5 ] }
327
- JSON.stringify(deep); // '{"a":1,"b":2,"c":[3,4,5]}'
328
- ```
329
-
330
- ### Embraces ES2015
331
-
332
- Immutable.js supports all JavaScript environments, including legacy
333
- browsers (even IE11). However it also takes advantage of features added to
334
- JavaScript in [ES2015][], the latest standard version of JavaScript, including
335
- [Iterators][], [Arrow Functions][], [Classes][], and [Modules][]. It's inspired
336
- by the native [Map][] and [Set][] collections added to ES2015.
337
-
338
- All examples in the Documentation are presented in ES2015. To run in all
339
- browsers, they need to be translated to ES5.
340
-
341
- ```js
342
- // ES2015
343
- const mapped = foo.map(x => x * x);
344
- // ES5
345
- var mapped = foo.map(function (x) {
346
- return x * x;
347
- });
348
- ```
349
-
350
- All Immutable.js collections are [Iterable][iterators], which allows them to be
351
- used anywhere an Iterable is expected, such as when spreading into an Array.
352
-
353
- <!-- runkit:activate -->
354
-
355
- ```js
356
- const { List } = require('immutable');
357
- const aList = List([1, 2, 3]);
358
- const anArray = [0, ...aList, 4, 5]; // [ 0, 1, 2, 3, 4, 5 ]
359
- ```
360
-
361
- Note: A Collection is always iterated in the same order, however that order may
362
- not always be well defined, as is the case for the `Map` and `Set`.
363
-
364
- [Iterators]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol
365
- [Arrow Functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
366
- [Classes]: https://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes
367
- [Modules]: https://www.2ality.com/2014/09/es6-modules-final.html
368
-
369
-
370
- ## Nested Structures
371
-
372
- The collections in Immutable.js are intended to be nested, allowing for deep
373
- trees of data, similar to JSON.
374
-
375
- <!-- runkit:activate -->
376
-
377
- ```js
378
- const { fromJS } = require('immutable');
379
- const nested = fromJS({ a: { b: { c: [3, 4, 5] } } });
380
- // Map { a: Map { b: Map { c: List [ 3, 4, 5 ] } } }
381
- ```
382
-
383
- A few power-tools allow for reading and operating on nested data. The
384
- most useful are `mergeDeep`, `getIn`, `setIn`, and `updateIn`, found on `List`,
385
- `Map` and `OrderedMap`.
386
-
387
- <!-- runkit:activate -->
388
-
389
- ```js
390
- const { fromJS } = require('immutable');
391
- const nested = fromJS({ a: { b: { c: [3, 4, 5] } } });
392
-
393
- const nested2 = nested.mergeDeep({ a: { b: { d: 6 } } });
394
- // Map { a: Map { b: Map { c: List [ 3, 4, 5 ], d: 6 } } }
395
-
396
- console.log(nested2.getIn(['a', 'b', 'd'])); // 6
397
-
398
- const nested3 = nested2.updateIn(['a', 'b', 'd'], value => value + 1);
399
- console.log(nested3);
400
- // Map { a: Map { b: Map { c: List [ 3, 4, 5 ], d: 7 } } }
401
-
402
- const nested4 = nested3.updateIn(['a', 'b', 'c'], list => list.push(6));
403
- // Map { a: Map { b: Map { c: List [ 3, 4, 5, 6 ], d: 7 } } }
404
- ```
405
-
406
- ## Equality treats Collections as Values
407
-
408
- Immutable.js collections are treated as pure data _values_. Two immutable
409
- collections are considered _value equal_ (via `.equals()` or `is()`) if they
410
- represent the same collection of values. This differs from JavaScript's typical
411
- _reference equal_ (via `===` or `==`) for Objects and Arrays which only
412
- determines if two variables represent references to the same object instance.
413
-
414
- Consider the example below where two identical `Map` instances are not
415
- _reference equal_ but are _value equal_.
416
-
417
- <!-- runkit:activate -->
418
-
419
- ```js
420
- // First consider:
421
- const obj1 = { a: 1, b: 2, c: 3 };
422
- const obj2 = { a: 1, b: 2, c: 3 };
423
- obj1 !== obj2; // two different instances are always not equal with ===
424
-
425
- const { Map, is } = require('immutable');
426
- const map1 = Map({ a: 1, b: 2, c: 3 });
427
- const map2 = Map({ a: 1, b: 2, c: 3 });
428
- map1 !== map2; // two different instances are not reference-equal
429
- map1.equals(map2); // but are value-equal if they have the same values
430
- is(map1, map2); // alternatively can use the is() function
431
- ```
432
-
433
- Value equality allows Immutable.js collections to be used as keys in Maps or
434
- values in Sets, and retrieved with different but equivalent collections:
435
-
436
- <!-- runkit:activate -->
437
-
438
- ```js
439
- const { Map, Set } = require('immutable');
440
- const map1 = Map({ a: 1, b: 2, c: 3 });
441
- const map2 = Map({ a: 1, b: 2, c: 3 });
442
- const set = Set().add(map1);
443
- set.has(map2); // true because these are value-equal
444
- ```
445
-
446
- Note: `is()` uses the same measure of equality as [Object.is][] for scalar
447
- strings and numbers, but uses value equality for Immutable collections,
448
- determining if both are immutable and all keys and values are equal
449
- using the same measure of equality.
450
-
451
- [object.is]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
452
-
453
- #### Performance tradeoffs
454
-
455
- While value equality is useful in many circumstances, it has different
456
- performance characteristics than reference equality. Understanding these
457
- tradeoffs may help you decide which to use in each case, especially when used
458
- to memoize some operation.
459
-
460
- When comparing two collections, value equality may require considering every
461
- item in each collection, on an `O(N)` time complexity. For large collections of
462
- values, this could become a costly operation. Though if the two are not equal
463
- and hardly similar, the inequality is determined very quickly. In contrast, when
464
- comparing two collections with reference equality, only the initial references
465
- to memory need to be compared which is not based on the size of the collections,
466
- which has an `O(1)` time complexity. Checking reference equality is always very
467
- fast, however just because two collections are not reference-equal does not rule
468
- out the possibility that they may be value-equal.
469
-
470
- #### Return self on no-op optimization
471
-
472
- When possible, Immutable.js avoids creating new objects for updates where no
473
- change in _value_ occurred, to allow for efficient _reference equality_ checking
474
- to quickly determine if no change occurred.
475
-
476
- <!-- runkit:activate -->
477
-
478
- ```js
479
- const { Map } = require('immutable');
480
- const originalMap = Map({ a: 1, b: 2, c: 3 });
481
- const updatedMap = originalMap.set('b', 2);
482
- updatedMap === originalMap; // No-op .set() returned the original reference.
483
- ```
484
-
485
- However updates which do result in a change will return a new reference. Each
486
- of these operations occur independently, so two similar updates will not return
487
- the same reference:
488
-
489
- <!-- runkit:activate -->
490
-
491
- ```js
492
- const { Map } = require('immutable');
493
- const originalMap = Map({ a: 1, b: 2, c: 3 });
494
- const updatedMap = originalMap.set('b', 1000);
495
- // New instance, leaving the original immutable.
496
- updatedMap !== originalMap;
497
- const anotherUpdatedMap = originalMap.set('b', 1000);
498
- // Despite both the results of the same operation, each created a new reference.
499
- anotherUpdatedMap !== updatedMap;
500
- // However the two are value equal.
501
- anotherUpdatedMap.equals(updatedMap);
502
- ```
503
-
504
- ## Batching Mutations
505
-
506
- > If a tree falls in the woods, does it make a sound?
507
- >
508
- > If a pure function mutates some local data in order to produce an immutable
509
- > return value, is that ok?
510
- >
511
- > — Rich Hickey, Clojure
512
-
513
- Applying a mutation to create a new immutable object results in some overhead,
514
- which can add up to a minor performance penalty. If you need to apply a series
515
- of mutations locally before returning, Immutable.js gives you the ability to
516
- create a temporary mutable (transient) copy of a collection and apply a batch of
517
- mutations in a performant manner by using `withMutations`. In fact, this is
518
- exactly how Immutable.js applies complex mutations itself.
519
-
520
- As an example, building `list2` results in the creation of 1, not 3, new
521
- immutable Lists.
522
-
523
- <!-- runkit:activate -->
524
-
525
- ```js
526
- const { List } = require('immutable');
527
- const list1 = List([1, 2, 3]);
528
- const list2 = list1.withMutations(function (list) {
529
- list.push(4).push(5).push(6);
530
- });
531
- assert.equal(list1.size, 3);
532
- assert.equal(list2.size, 6);
533
- ```
534
-
535
- Note: Immutable.js also provides `asMutable` and `asImmutable`, but only
536
- encourages their use when `withMutations` will not suffice. Use caution to not
537
- return a mutable copy, which could result in undesired behavior.
538
-
539
- _Important!_: Only a select few methods can be used in `withMutations` including
540
- `set`, `push` and `pop`. These methods can be applied directly against a
541
- persistent data-structure where other methods like `map`, `filter`, `sort`,
542
- and `splice` will always return new immutable data-structures and never mutate
543
- a mutable collection.
544
-
545
- ## Lazy Seq
546
-
547
- `Seq` describes a lazy operation, allowing them to efficiently chain
548
- use of all the higher-order collection methods (such as `map` and `filter`)
549
- by not creating intermediate collections.
550
-
551
- **Seq is immutable** — Once a Seq is created, it cannot be
552
- changed, appended to, rearranged or otherwise modified. Instead, any mutative
553
- method called on a `Seq` will return a new `Seq`.
554
-
555
- **Seq is lazy** — `Seq` does as little work as necessary to respond to any
556
- method call. Values are often created during iteration, including implicit
557
- iteration when reducing or converting to a concrete data structure such as
558
- a `List` or JavaScript `Array`.
559
-
560
- For example, the following performs no work, because the resulting
561
- `Seq`'s values are never iterated:
562
-
563
- ```js
564
- const { Seq } = require('immutable');
565
- const oddSquares = Seq([1, 2, 3, 4, 5, 6, 7, 8])
566
- .filter(x => x % 2 !== 0)
567
- .map(x => x * x);
568
- ```
569
-
570
- Once the `Seq` is used, it performs only the work necessary. In this
571
- example, no intermediate arrays are ever created, filter is called three
572
- times, and map is only called once:
573
-
574
- ```js
575
- oddSquares.get(1); // 9
576
- ```
577
-
578
- Any collection can be converted to a lazy Seq with `Seq()`.
579
-
580
- <!-- runkit:activate -->
581
-
582
- ```js
583
- const { Map, Seq } = require('immutable');
584
- const map = Map({ a: 1, b: 2, c: 3 });
585
- const lazySeq = Seq(map);
586
- ```
587
-
588
- `Seq` allows for the efficient chaining of operations, allowing for the
589
- expression of logic that can otherwise be very tedious:
590
-
591
- ```js
592
- lazySeq
593
- .flip()
594
- .map(key => key.toUpperCase())
595
- .flip();
596
- // Seq { A: 1, B: 2, C: 3 }
597
- ```
598
-
599
- As well as expressing logic that would otherwise seem memory or time
600
- limited, for example `Range` is a special kind of Lazy sequence.
601
-
602
- <!-- runkit:activate -->
603
-
604
- ```js
605
- const { Range } = require('immutable');
606
- Range(1, Infinity)
607
- .skip(1000)
608
- .map(n => -n)
609
- .filter(n => n % 2 === 0)
610
- .take(2)
611
- .reduce((r, n) => r * n, 1);
612
- // 1006008
613
- ```
614
-
615
- ## Documentation
616
-
617
- ## Documentation
618
-
619
- [Read the docs](https://immutable-js.com) and eat your vegetables.
620
-
621
- Docs are automatically generated from [Immutable.d.ts](https://github.com/immutable-js/immutable-js/blob/main/type-definitions/Immutable.d.ts).
622
- Please contribute!
623
-
624
- Also, don't miss the [Wiki](https://github.com/immutable-js/immutable-js/wiki) which
625
- contains articles on specific topics. Can't find something? Open an [issue](https://github.com/immutable-js/immutable-js/issues).
626
-
627
- ## Testing
628
-
629
- If you are using the [Chai Assertion Library](https://chaijs.com/), [Chai Immutable](https://github.com/astorije/chai-immutable) provides a set of assertions to use against Immutable.js collections.
630
-
631
- ## Contribution
632
-
633
- ## Contribution
634
-
635
- Use [Github issues](https://github.com/immutable-js/immutable-js/issues) for requests.
636
-
637
- We actively welcome pull requests, learn how to [contribute](https://github.com/immutable-js/immutable-js/blob/main/.github/CONTRIBUTING.md).
638
-
639
- Immutable.js is maintained within the [Contributor Covenant's Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/).
640
-
641
- We actively welcome pull requests, learn how to [contribute](https://github.com/immutable-js/immutable-js/blob/main/.github/CONTRIBUTING.md).
642
-
643
- ## Changelog
644
-
645
- Changes are tracked as [Github releases](https://github.com/immutable-js/immutable-js/releases).
646
-
647
- ## Thanks
648
-
649
- [Phil Bagwell](https://www.youtube.com/watch?v=K2NYwP90bNs), for his inspiration
650
- and research in persistent data structures.
651
-
652
- [Hugh Jackson](https://github.com/hughfdjackson/), for providing the npm package
653
- name. If you're looking for his unsupported package, see [this repository](https://github.com/hughfdjackson/immutable).
654
-
655
- ## License
656
-
657
- Immutable.js is [MIT-licensed](./LICENSE).