Merge pull request #950 from pspi/underscore_omit_fix

Function _.omit() accepts array of strings as well.
This commit is contained in:
basarat
2013-08-26 10:09:50 -07:00
2 changed files with 5 additions and 4 deletions
+3 -1
View File
@@ -148,7 +148,9 @@ _.invert({ Moe: "Moses", Larry: "Louis", Curly: "Jerome" });
_.functions(_);
_.extend({ name: 'moe' }, { age: 50 });
_.pick({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, ['name', 'age']);
var iceCream = { flavor: "chocolate" };
_.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" });
+2 -3
View File
@@ -1040,9 +1040,8 @@ declare module _ {
* @param keys The key/value pairs to remove on `object`.
* @return Copy of `object` without the `keys` properties.
**/
export function omit(
object: any,
...keys: string[]): any;
export function omit(object: any, ...keys: string[]): any;
export function omit(object: any, keys: string[]): any;
/**
* Fill in null and undefined properties in object with values from the defaults objects,