Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbc50c7

Browse filesBrowse files
committed
rename LazySequence to Seq
1 parent 767e990 commit bbc50c7
Copy full SHA for bbc50c7

35 files changed

+561
-561
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ results, these operations are extremely efficient.
176176
177177
```javascript
178178
var myObject = {a:1,b:2,c:3};
179-
Sequence(myObject).map(x => x * x).toObject();
179+
Seq(myObject).map(x => x * x).toObject();
180180
// { a: 1, b: 4, c: 9 }
181181
```
182182
@@ -274,7 +274,7 @@ A common pattern is reifying (converting to real form) back to the original
274274
collection type. For example, mapping over a Vector:
275275
276276
var numsVect = Immutable.Vector.of(1,2,3,4,5);
277-
var squaresVect = numsVect.map(x => x * x).toVector();
277+
var squaresVect = numsVect.map(x => x * x);
278278
279279
Note: A sequence is always iterated in the same order, however that order may
280280
not always be well defined, as is the case for the `Map`.

‎__tests__/ArraySequence.ts renamed to ‎__tests__/ArraySeq.ts

Copy file name to clipboardExpand all lines: __tests__/ArraySeq.ts
+17-17Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@ import Immutable = require('immutable');
77
describe('ArraySequence', () => {
88

99
it('every is true when predicate is true for all entries', () => {
10-
expect(Immutable.LazySequence([]).every(() => false)).toBe(true);
11-
expect(Immutable.LazySequence([1,2,3]).every(v => v > 0)).toBe(true);
12-
expect(Immutable.LazySequence([1,2,3]).every(v => v < 3)).toBe(false);
10+
expect(Immutable.Seq([]).every(() => false)).toBe(true);
11+
expect(Immutable.Seq([1,2,3]).every(v => v > 0)).toBe(true);
12+
expect(Immutable.Seq([1,2,3]).every(v => v < 3)).toBe(false);
1313
});
1414

1515
it('some is true when predicate is true for any entry', () => {
16-
expect(Immutable.LazySequence([]).some(() => true)).toBe(false);
17-
expect(Immutable.LazySequence([1,2,3]).some(v => v > 0)).toBe(true);
18-
expect(Immutable.LazySequence([1,2,3]).some(v => v < 3)).toBe(true);
19-
expect(Immutable.LazySequence([1,2,3]).some(v => v > 1)).toBe(true);
20-
expect(Immutable.LazySequence([1,2,3]).some(v => v < 0)).toBe(false);
16+
expect(Immutable.Seq([]).some(() => true)).toBe(false);
17+
expect(Immutable.Seq([1,2,3]).some(v => v > 0)).toBe(true);
18+
expect(Immutable.Seq([1,2,3]).some(v => v < 3)).toBe(true);
19+
expect(Immutable.Seq([1,2,3]).some(v => v > 1)).toBe(true);
20+
expect(Immutable.Seq([1,2,3]).some(v => v < 0)).toBe(false);
2121
});
2222

2323
it('maps', () => {
24-
var i = Immutable.LazySequence([1,2,3]);
24+
var i = Immutable.Seq([1,2,3]);
2525
var m = i.map(x => x + x).toObject();
2626
expect(m).toEqual([2,4,6]);
2727
});
2828

2929
it('reduces', () => {
30-
var i = Immutable.LazySequence([1,2,3]);
30+
var i = Immutable.Seq([1,2,3]);
3131
var r = i.reduce<number>((r, x) => r + x);
3232
expect(r).toEqual(6);
3333
});
3434

3535
it('efficiently chains iteration methods', () => {
36-
var i = Immutable.LazySequence('abcdefghijklmnopqrstuvwxyz'.split(''));
36+
var i = Immutable.Seq('abcdefghijklmnopqrstuvwxyz'.split(''));
3737
function studly(letter, index) {
3838
return index % 2 === 0 ? letter : letter.toUpperCase();
3939
}
@@ -42,7 +42,7 @@ describe('ArraySequence', () => {
4242
});
4343

4444
it('counts from the end of the sequence on negative index', () => {
45-
var i = Immutable.LazySequence.of(1, 2, 3, 4, 5, 6, 7);
45+
var i = Immutable.Seq.of(1, 2, 3, 4, 5, 6, 7);
4646
expect(i.get(-1)).toBe(7);
4747
expect(i.get(-5)).toBe(3);
4848
expect(i.get(-9)).toBe(undefined);
@@ -52,7 +52,7 @@ describe('ArraySequence', () => {
5252
it('handles trailing holes', () => {
5353
var a = [1,2,3];
5454
a.length = 10;
55-
var seq = Immutable.LazySequence(a);
55+
var seq = Immutable.Seq(a);
5656
expect(seq.size).toBe(10);
5757
expect(seq.toArray().length).toBe(10);
5858
expect(seq.map(x => x*x).size).toBe(10);
@@ -68,7 +68,7 @@ describe('ArraySequence', () => {
6868

6969
it('can be iterated', () => {
7070
var a = [1,2,3];
71-
var seq = Immutable.LazySequence(a);
71+
var seq = Immutable.Seq(a);
7272
var entries = seq.entries();
7373
expect(entries.next()).toEqual({ value: [0, 1], done: false });
7474
expect(entries.next()).toEqual({ value: [1, 2], done: false });
@@ -77,10 +77,10 @@ describe('ArraySequence', () => {
7777
});
7878

7979
it('cannot be mutated after calling toArray', () => {
80-
var seq = Immutable.LazySequence(['A', 'B', 'C']);
80+
var seq = Immutable.Seq(['A', 'B', 'C']);
8181

82-
var firstReverse = Immutable.LazySequence(seq.toArray().reverse());
83-
var secondReverse = Immutable.LazySequence(seq.toArray().reverse());
82+
var firstReverse = Immutable.Seq(seq.toArray().reverse());
83+
var secondReverse = Immutable.Seq(seq.toArray().reverse());
8484

8585
expect(firstReverse.get(0)).toEqual('C');
8686
expect(secondReverse.get(0)).toEqual('C');

‎__tests__/Equality.ts

Copy file name to clipboardExpand all lines: __tests__/Equality.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ describe('Equality', () => {
5252
});
5353

5454
it('compares sequences', () => {
55-
var arraySeq = Immutable.LazySequence.of(1,2,3);
56-
var arraySeq2 = Immutable.LazySequence([1,2,3]);
55+
var arraySeq = Immutable.Seq.of(1,2,3);
56+
var arraySeq2 = Immutable.Seq([1,2,3]);
5757
expectIs(arraySeq, arraySeq);
58-
expectIs(arraySeq, Immutable.LazySequence.of(1,2,3));
58+
expectIs(arraySeq, Immutable.Seq.of(1,2,3));
5959
expectIs(arraySeq2, arraySeq2);
60-
expectIs(arraySeq2, Immutable.LazySequence([1,2,3]));
60+
expectIs(arraySeq2, Immutable.Seq([1,2,3]));
6161
expectIsNot(arraySeq, [1,2,3]);
6262
expectIsNot(arraySeq2, [1,2,3]);
6363
expectIs(arraySeq, arraySeq2);
@@ -70,7 +70,7 @@ describe('Equality', () => {
7070
expectIs(vector, vector);
7171
expectIsNot(vector, [1,2,3]);
7272

73-
expectIs(vector, Immutable.LazySequence.of(1,2,3));
73+
expectIs(vector, Immutable.Seq.of(1,2,3));
7474
expectIs(vector, Immutable.Vector.of(1,2,3));
7575

7676
var vectorLonger = vector.push(4);

‎__tests__/IndexedSequence.ts renamed to ‎__tests__/IndexedSeq.ts

Copy file name to clipboardExpand all lines: __tests__/IndexedSeq.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Immutable = require('immutable');
1010
describe('IndexedSequence', () => {
1111

1212
it('maintains skipped offset', () => {
13-
var seq = Immutable.LazySequence(['A', 'B', 'C', 'D', 'E']);
13+
var seq = Immutable.Seq(['A', 'B', 'C', 'D', 'E']);
1414

1515
// This is what we expect for IndexedSequences
1616
var operated = seq.skip(1);
@@ -25,7 +25,7 @@ describe('IndexedSequence', () => {
2525
});
2626

2727
it('reverses correctly', () => {
28-
var seq = Immutable.LazySequence(['A', 'B', 'C', 'D', 'E']);
28+
var seq = Immutable.Seq(['A', 'B', 'C', 'D', 'E']);
2929

3030
// This is what we expect for IndexedSequences
3131
var operated = seq.reverse();

‎__tests__/IterableSequence.ts renamed to ‎__tests__/IterableSeq.ts

Copy file name to clipboardExpand all lines: __tests__/IterableSeq.ts
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ describe('IterableSequence', () => {
99

1010
it('creates a sequence from an iterable', () => {
1111
var i = new SimpleIterable();
12-
var s = Immutable.LazySequence(i);
12+
var s = Immutable.Seq(i);
1313
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
1414
})
1515

1616
it('is stable', () => {
1717
var i = new SimpleIterable();
18-
var s = Immutable.LazySequence(i);
18+
var s = Immutable.Seq(i);
1919
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
2020
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
2121
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
2222
})
2323

2424
it('counts iterations', () => {
2525
var i = new SimpleIterable(10);
26-
var s = Immutable.LazySequence(i);
26+
var s = Immutable.Seq(i);
2727
expect(s.forEach(x => x)).toEqual(10);
2828
expect(s.take(5).forEach(x => x)).toEqual(5);
2929
expect(s.forEach(x => x < 3)).toEqual(4);
@@ -32,7 +32,7 @@ describe('IterableSequence', () => {
3232
it('creates a new iterator on every operations', () => {
3333
var mockFn = jest.genMockFunction();
3434
var i = new SimpleIterable(3, mockFn);
35-
var s = Immutable.LazySequence(i);
35+
var s = Immutable.Seq(i);
3636
expect(s.toArray()).toEqual([ 0,1,2 ]);
3737
expect(mockFn.mock.calls).toEqual([[0],[1],[2]]);
3838
// The iterator is recreated for the second time.
@@ -43,7 +43,7 @@ describe('IterableSequence', () => {
4343
it('can be iterated', () => {
4444
var mockFn = jest.genMockFunction();
4545
var i = new SimpleIterable(3, mockFn);
46-
var seq = Immutable.LazySequence(i);
46+
var seq = Immutable.Seq(i);
4747
var entries = seq.entries();
4848
expect(entries.next()).toEqual({ value: [0, 0], done: false });
4949
// The iteration is lazy
@@ -64,7 +64,7 @@ describe('IterableSequence', () => {
6464
it('can be mapped and filtered', () => {
6565
var mockFn = jest.genMockFunction();
6666
var i = new SimpleIterable(undefined, mockFn); // infinite
67-
var seq = Immutable.LazySequence<number, number>(i)
67+
var seq = Immutable.Seq<number, number>(i)
6868
.filter(x => x % 2 === 1)
6969
.map(x => x * x);
7070
var entries = seq.entries();
@@ -78,21 +78,21 @@ describe('IterableSequence', () => {
7878

7979
it('creates a sequence from a raw iterable', () => {
8080
var i = new SimpleIterable(10);
81-
var s = Immutable.LazySequence(i['@@iterator']());
81+
var s = Immutable.Seq(i['@@iterator']());
8282
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
8383
})
8484

8585
it('is stable', () => {
8686
var i = new SimpleIterable(10);
87-
var s = Immutable.LazySequence(i['@@iterator']());
87+
var s = Immutable.Seq(i['@@iterator']());
8888
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
8989
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
9090
expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]);
9191
})
9292

9393
it('counts iterations', () => {
9494
var i = new SimpleIterable(10);
95-
var s = Immutable.LazySequence(i['@@iterator']());
95+
var s = Immutable.Seq(i['@@iterator']());
9696
expect(s.forEach(x => x)).toEqual(10);
9797
expect(s.take(5).forEach(x => x)).toEqual(5);
9898
expect(s.forEach(x => x < 3)).toEqual(4);
@@ -101,7 +101,7 @@ describe('IterableSequence', () => {
101101
it('memoizes the iterator', () => {
102102
var mockFn = jest.genMockFunction();
103103
var i = new SimpleIterable(10, mockFn);
104-
var s = Immutable.LazySequence(i['@@iterator']());
104+
var s = Immutable.Seq(i['@@iterator']());
105105
expect(s.take(3).toArray()).toEqual([ 0,1,2 ]);
106106
expect(mockFn.mock.calls).toEqual([[0],[1],[2]]);
107107

@@ -117,7 +117,7 @@ describe('IterableSequence', () => {
117117
it('can be iterated', () => {
118118
var mockFn = jest.genMockFunction();
119119
var i = new SimpleIterable(3, mockFn);
120-
var seq = Immutable.LazySequence(i['@@iterator']());
120+
var seq = Immutable.Seq(i['@@iterator']());
121121
var entries = seq.entries();
122122
expect(entries.next()).toEqual({ value: [0, 0], done: false });
123123
// The iteration is lazy

‎__tests__/KeyedIndexedSequence.ts renamed to ‎__tests__/KeyedSeq.ts

Copy file name to clipboardExpand all lines: __tests__/KeyedSeq.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jasmineCheck.install();
77

88
import Immutable = require('immutable');
99

10-
describe('KeyedIndexedSequence', () => {
10+
describe('KeyedSeq', () => {
1111

1212
check.it('is equivalent', [gen.array(gen.int)], (ints) => {
13-
var seq = Immutable.LazySequence(ints);
13+
var seq = Immutable.Seq(ints);
1414
var keyed = seq.toKeyedSeq();
1515
expect(seq.equals(keyed)).toBe(true);
1616
});

‎__tests__/Map.ts

Copy file name to clipboardExpand all lines: __tests__/Map.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Map', () => {
3636
});
3737

3838
it('constructor provides initial values as sequence', () => {
39-
var s = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
39+
var s = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
4040
var m = Map(s);
4141
expect(m.size).toBe(3);
4242
expect(m.get('a')).toBe('A');

‎__tests__/ObjectSequence.ts renamed to ‎__tests__/ObjectSeq.ts

Copy file name to clipboardExpand all lines: __tests__/ObjectSeq.ts
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,38 @@ import Immutable = require('immutable');
88
describe('ObjectSequence', () => {
99

1010
it('maps', () => {
11-
var i = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
11+
var i = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
1212
var m = i.map(x => x + x).toObject();
1313
expect(m).toEqual({'a': 'AA', 'b': 'BB', 'c': 'CC'});
1414
});
1515

1616
it('reduces', () => {
17-
var i = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
17+
var i = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
1818
var r = i.reduce<string>((r, x) => r + x, '');
1919
expect(r).toEqual('ABC');
2020
});
2121

2222
it('extracts keys', () => {
23-
var i = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
23+
var i = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
2424
var k = i.keySeq().toArray();
2525
expect(k).toEqual(['a', 'b', 'c']);
2626
});
2727

2828
it('is reversable', () => {
29-
var i = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
29+
var i = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
3030
var k = i.reverse().toArray();
3131
expect(k).toEqual(['C', 'B', 'A']);
3232
});
3333

3434
it('can double reversable', () => {
35-
var i = Immutable.LazySequence({'a': 'A', 'b': 'B', 'c': 'C'});
35+
var i = Immutable.Seq({'a': 'A', 'b': 'B', 'c': 'C'});
3636
var k = i.reverse().reverse().toArray();
3737
expect(k).toEqual(['A', 'B', 'C']);
3838
});
3939

4040
it('can be iterated', () => {
4141
var obj = { a: 1, b: 2, c: 3 };
42-
var seq = Immutable.LazySequence(obj);
42+
var seq = Immutable.Seq(obj);
4343
var entries = seq.entries();
4444
expect(entries.next()).toEqual({ value: ['a', 1], done: false });
4545
expect(entries.next()).toEqual({ value: ['b', 2], done: false });
@@ -48,11 +48,11 @@ describe('ObjectSequence', () => {
4848
});
4949

5050
it('cannot be mutated after calling toObject', () => {
51-
var seq = Immutable.LazySequence({ a: 1, b: 2, c: 3 });
51+
var seq = Immutable.Seq({ a: 1, b: 2, c: 3 });
5252

5353
var obj = seq.toObject();
5454
obj['c'] = 10;
55-
var seq2 = Immutable.LazySequence(obj);
55+
var seq2 = Immutable.Seq(obj);
5656

5757
expect(seq.get('c')).toEqual(3);
5858
expect(seq2.get('c')).toEqual(10);

‎__tests__/OrderedMap.ts

Copy file name to clipboardExpand all lines: __tests__/OrderedMap.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('OrderedMap', () => {
3535
});
3636

3737
it('constructor accepts sequences', () => {
38-
var s = Immutable.LazySequence({'c': 'C', 'b': 'B', 'a': 'A'});
38+
var s = Immutable.Seq({'c': 'C', 'b': 'B', 'a': 'A'});
3939
var m = OrderedMap(s);
4040
expect(m.get('a')).toBe('A');
4141
expect(m.get('b')).toBe('B');

‎__tests__/Record.ts

Copy file name to clipboardExpand all lines: __tests__/Record.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ describe('Record', () => {
5555

5656
it('converts sequences to records', () => {
5757
var MyType = Record({a:1, b:2, c:3});
58-
var seq = Immutable.LazySequence({a: 10, b:20});
58+
var seq = Immutable.Seq({a: 10, b:20});
5959
var t = new MyType(seq);
6060
expect(t.toObject()).toEqual({a:10, b:20, c:3})
6161
})
6262

6363
it('allows for functional construction', () => {
6464
var MyType = Record({a:1, b:2, c:3});
65-
var seq = Immutable.LazySequence({a: 10, b:20});
65+
var seq = Immutable.Seq({a: 10, b:20});
6666
var t = MyType(seq);
6767
expect(t.toObject()).toEqual({a:10, b:20, c:3})
6868
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.