Add more _.omit benchmarks and update Underscore.

Former-commit-id: b8de29706b381ebc000a7cbaa19aa0a2a628d6a8
This commit is contained in:
John-David Dalton
2012-08-25 01:04:33 -07:00
parent c7f290f42e
commit 0e4afefc7f
4 changed files with 89 additions and 19 deletions

View File

@@ -48,6 +48,10 @@ $(document).ready(function() {
ok(_.isEqual(result, {b:2, c:3}), 'can restrict properties to those named in an array');
result = _.pick({a:1, b:2, c:3}, ['a'], 'b');
ok(_.isEqual(result, {a:1, b:2}), 'can restrict properties to those named in mixed args');
var Obj = function(){};
Obj.prototype = {a: 1, b: 2, c: 3};
ok(_.isEqual(_.pick(new Obj, 'a', 'c'), {a:1, c: 3}), 'include prototype props');
});
test("objects: omit", function() {
@@ -58,6 +62,10 @@ $(document).ready(function() {
ok(_.isEqual(result, {b:2}), 'can omit several named properties');
result = _.omit({a:1, b:2, c:3}, ['b', 'c']);
ok(_.isEqual(result, {a:1}), 'can omit properties named in an array');
var Obj = function(){};
Obj.prototype = {a: 1, b: 2, c: 3};
ok(_.isEqual(_.omit(new Obj, 'b'), {a:1, c: 3}), 'include prototype props');
});
test("objects: defaults", function() {