8000 Some README improvements · ui-frontend/immutable-js@e6aa38d · GitHub
[go: up one dir, main page]

Skip to content

Commit e6aa38d

Browse files
committed
Some README improvements
1 parent 7458646 commit e6aa38d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Immutable Data Collections
33

44
Immutable data cannot be changed once created, leading to much simpler
55
application development and enabling techniques from functional programming such
6-
as lazy evaluation. This provides a lazy `Sequence`, allowing efficient chaining
7-
of sequence methods like `map` and `filter` without creating intermediate
8-
representations.
6+
as lazy evaluation. Immutable JS provides a lazy `Sequence`, allowing efficient
7+
chaining of sequence methods like `map` and `filter` without creating
8+
intermediate representations.
99

1010
`immutable` provides `Sequence`, `Range`, `Repeat`, `Map`, `OrderedMap`, `Set`
1111
and a sparse `Vector` by using lazy sequences and [hash maps tries](http://en.wikipedia.org/wiki/Hash_array_mapped_trie).
@@ -43,6 +43,8 @@ require the full file path)
4343
import Immutable = require('./node_modules/immutable/dist/Immutable');
4444
var map: Immutable.Map<string, number>;
4545
map = Immutable.Map({a:1, b:2, c:3});
46+
map = map.set('b', 20);
47+
map.get( D89F 'b'); // 20
4648
```
4749

4850

@@ -109,6 +111,7 @@ assert(vect1.length === 2);
109111
assert(vect2.length === 5);
110112
assert(vect3.length === 3);
111113
assert(vect4.length === 10);
114+
assert(vect4.get(0) === 2);
112115
```
113116

114117
Almost all of the methods on `Array` will be found in similar form on
@@ -121,6 +124,8 @@ alpha.map((v, k) => k.toUpperCase()).join();
121124
// 'A,B,C,D'
122125
```
123126

127+
### Accepts raw JavaScript objects.
128+
124129
Designed to inter-operate with your existing JavaScript, `immutable`
125130
accepts plain JavaScript Array and Objects anywhere a method expects a
126131
`Sequence` with no performance penalty.
@@ -145,6 +150,8 @@ Sequence(myObject).map(x => x * x).toObject();
145150
// { a: 1, b: 4, c: 9 }
146151
```
147152

153+
### Converts back to raw JavaScript objects.
154+
148155
All `immutable` Sequences can be converted to plain JavaScript Arrays and
149156
Objects shallowly with `toArray()` and `toObject()` or deeply with `toJSON()`,
150157
allowing `JSON.stringify` to work automatically.

0 commit comments

Comments
 (0)
0