Skip to content

Commit a660faf

Browse files
committed
generalize first/last for indexed seq
1 parent 5e651ed commit a660faf

File tree

5 files changed

+21
-35
lines changed

5 files changed

+21
-35
lines changed

dist/Immutable.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,12 @@ var $IndexedSequence = IndexedSequence;
704704
return key === index;
705705
}), null, notSetValue);
706706
},
707+
first: function() {
708+
return this.get(0);
709+
},
710+
last: function() {
711+
return this.get(this.length ? this.length - 1 : 0);
712+
},
707713
indexOf: function(searchValue) {
708714
return this.findIndex((function(value) {
709715
return is(value, searchValue);
@@ -1708,12 +1714,6 @@ var $Vector = Vector;
17081714
var node = vectorNodeFor(this, index);
17091715
return node && node.array[index & MASK];
17101716
},
1711-
first: function() {
1712-
return this.get(0);
1713-
},
1714-
last: function() {
1715-
return this.get(this.length ? this.length - 1 : 0);
1716-
},
17171717
set: function(index, value) {
17181718
return updateVector(this, index, value);
17191719
},
@@ -2758,12 +2758,6 @@ var $Repeat = Repeat;
27582758
get: function(index, notSetValue) {
27592759
return this.has(index) ? this._value : notSetValue;
27602760
},
2761-
first: function() {
2762-
return this._value;
2763-
},
2764-
last: function() {
2765-
return this._value;
2766-
},
27672761
contains: function(searchValue) {
27682762
return is(this._value, searchValue);
27692763
},

0 commit comments

Comments
 (0)