Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions set.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var value = true
}

var Set = function(input){
if (!(this instanceof Set)) return new Set(input)
this._set = unique(input || [])
}

Expand Down
16 changes: 16 additions & 0 deletions test/set-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,21 @@ vows.describe('Set').addBatch({
}
}
}

, "Initialized with [0,1,2,3,4] without the new keyword": {
topic: Set([0, 1, 2, 3, 4])

, "will be a Set": function(topic){
assert.instanceOf(topic, Set)
}

, "is not empty": function(topic){
assert.isFalse(topic.empty())
}

, "contains a 0": function(topic){
assert.isTrue(topic.contains(0))
}
}
}
}).export(module)