Null properties? I don't see the point.

This commit is contained in:
Zixaphir 2014-01-05 10:34:23 -07:00
parent 482f6444fe
commit bb5dcaa409
3 changed files with 3 additions and 17 deletions

View File

@ -1460,8 +1460,6 @@
RandomAccessList = (function() { RandomAccessList = (function() {
function RandomAccessList() { function RandomAccessList() {
this.first = null;
this.last = null;
this.length = 0; this.length = 0;
} }
@ -1469,10 +1467,7 @@
var ID, last; var ID, last;
ID = item.ID; ID = item.ID;
last = this.last; last = this.last;
$.extend(item, { item.prev = last;
prev: last,
next: null
});
this[ID] = item; this[ID] = item;
this.last = last ? last.next = item : this.first = item; this.last = last ? last.next = item : this.first = item;
return this.length++; return this.length++;

View File

@ -1466,8 +1466,6 @@
RandomAccessList = (function() { RandomAccessList = (function() {
function RandomAccessList() { function RandomAccessList() {
this.first = null;
this.last = null;
this.length = 0; this.length = 0;
} }
@ -1475,10 +1473,7 @@
var ID, last; var ID, last;
ID = item.ID; ID = item.ID;
last = this.last; last = this.last;
$.extend(item, { item.prev = last;
prev: last,
next: null
});
this[ID] = item; this[ID] = item;
this.last = last ? last.next = item : this.first = item; this.last = last ? last.next = item : this.first = item;
return this.length++; return this.length++;

View File

@ -1,15 +1,11 @@
class RandomAccessList class RandomAccessList
constructor: -> constructor: ->
@first = null
@last = null
@length = 0 @length = 0
push: (item) -> push: (item) ->
{ID} = item {ID} = item
{last} = @ {last} = @
$.extend item, item.prev = last
prev: last
next: null
@[ID] = item @[ID] = item
@last = if last @last = if last
last.next = item last.next = item