getting ready for 0.1

This commit is contained in:
Jeremy Ashkenas
2009-10-27 13:26:36 -04:00
parent 5e3f783a23
commit ef10906b5f
6 changed files with 115 additions and 55 deletions

View File

@@ -1,12 +1,14 @@
// Underscore.js
// (c) 2009 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the terms of the MIT license.
// Portions of Underscore are inspired by or borrowed from Prototype.js,
// Oliver Steele's Functional, And John Resig's Micro-Templating.
// For all details and documentation:
// http://fdjklsafjsdalk
// http://documentcloud.github.com/underscore/
window._ = {
VERSION : '0.1.0',
// The cornerstone, an each implementation.
// Handles objects implementing forEach, _each, arrays, and raw objects.
each : function(obj, iterator, context) {
@@ -243,9 +245,9 @@ window._ = {
// passed-in arrays.
intersect : function(array) {
var rest = _.toArray(arguments).slice(1);
return _.select(_.uniq(array), function(item1) {
return _.select(_.uniq(array), function(item) {
return _.all(rest, function(other) {
return _.detect(other, function(item2){ return item1 === item2; });
return _.indexOf(other, item) >= 0;
});
});
},