Skip to content
This repository has been archived by the owner on Mar 27, 2018. It is now read-only.

Commit

Permalink
Addition of TODO (really, it's DONE); Modified Manager.map & Manager.…
Browse files Browse the repository at this point in the history
…filter to remove an unneeded variable declaration
  • Loading branch information
miksago committed Jul 20, 2010
1 parent ecb6a7c commit 980bfd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## NWS TODO ##

* nothing

## NWS Done ##

* change `server` constructor to have externalServer as option, not argument
* add `connection._req.headers` -> `connection.headers`
* abstract `connection.storage` to use a standard API & events
* add `manager.map` should have similar api to Array.map
6 changes: 2 additions & 4 deletions lib/ws/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,20 @@ Manager.prototype.map = function(callback, thisArg){
var current = this._head
, len = 0
, result = new Array(this._length);
, mappedValue;

while(current !== null){
result[len] = callback.call(thisArg, current.client, len, this._head);
current = current._next;
++len;
}

return result;
};

Manager.prototype.filter = function(callback, thisArg){
var current = this._head
, len = 0
, result = new Array(this._length);
, mappedValue;

while(current !== null){
if( Boolean(callback.call(thisArg, current.client, len, this._head)) ){
Expand All @@ -124,6 +122,6 @@ Manager.prototype.filter = function(callback, thisArg){

current = current._next;
}

return result;
};

0 comments on commit 980bfd2

Please sign in to comment.