Skip to content

Commit

Permalink
Underscore 0.4.7 is done
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Dec 6, 2009
1 parent 7a1f92a commit 4bd535e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
9 changes: 9 additions & 0 deletions Rakefile
@@ -0,0 +1,9 @@
require 'rubygems'
require 'closure-compiler'

desc "Use the Closure Compiler to compress Underscore.js"
task :build do
js = File.open('underscore.js', 'r')
min = Closure::Compiler.new.compile(js)
File.open('underscore-min.js', 'w') {|f| f.write(min) }
end
5 changes: 4 additions & 1 deletion index.html
Expand Up @@ -998,7 +998,10 @@ <h2>Change Log</h2>

<p>
<b class="header">0.4.7</b><br />

Added <tt>isDate</tt>, <tt>isNaN</tt>, and <tt>isNull</tt>, for completeness.
Optimizations for <tt>isEqual</tt> when checking equality between Arrays
or Dates. <tt>_.keys</tt> is now <small><i><b>25%&ndash;2X</b></i></small> faster (depending on your
browser) which speeds up the functions that rely on it, such as <tt>_.each</tt>.
</p>

<p>
Expand Down
30 changes: 15 additions & 15 deletions underscore-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions underscore.js
Expand Up @@ -31,7 +31,7 @@
if (typeof exports !== 'undefined') exports._ = _;

// Maintain a reference to the Object prototype for quick access.
var oproto = Object.prototype;
var objPro = Object.prototype;

// Current version.
_.VERSION = '0.4.7';
Expand Down Expand Up @@ -395,7 +395,7 @@
_.keys = function(obj) {
if(_.isArray(obj)) return _.range(0, obj.length);
var keys = [];
for (var key in obj) if (oproto.hasOwnProperty.call(obj, key)) keys.push(key);
for (var key in obj) if (objPro.hasOwnProperty.call(obj, key)) keys.push(key);
return keys;
};

Expand Down Expand Up @@ -456,27 +456,27 @@

// Is a given value a real Array?
_.isArray = function(obj) {
return oproto.toString.call(obj) == '[object Array]';
return objPro.toString.call(obj) == '[object Array]';
};

// Is a given value a Function?
_.isFunction = function(obj) {
return oproto.toString.call(obj) == '[object Function]';
return objPro.toString.call(obj) == '[object Function]';
};

// Is a given value a String?
_.isString = function(obj) {
return oproto.toString.call(obj) == '[object String]';
return objPro.toString.call(obj) == '[object String]';
};

// Is a given value a Number?
_.isNumber = function(obj) {
return oproto.toString.call(obj) == '[object Number]';
return objPro.toString.call(obj) == '[object Number]';
};

// Is a given value a Date?
_.isDate = function(obj) {
return oproto.toString.call(obj) == '[object Date]';
return objPro.toString.call(obj) == '[object Date]';
};

// Is the given value NaN -- this one is interesting. NaN != NaN, and
Expand Down

0 comments on commit 4bd535e

Please sign in to comment.