diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 61854aee36..ab59e31b9f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -669,7 +669,7 @@ var mergeAges = { ] }; -_.merge(mergeNames, mergeAges); +result = _.merge(mergeNames, mergeAges); var mergeFood = { 'fruits': ['apple'], @@ -681,10 +681,16 @@ var mergeOtherFood = { 'vegetables': ['carrot'] }; -_.merge(mergeFood, mergeOtherFood, function(a, b) { +result = _.merge(mergeFood, mergeOtherFood, function(a, b) { return _.isArray(a) ? a.concat(b) : undefined; }); +result = _.omit({ 'name': 'moe', 'age': 40 }, 'age'); +result = _.omit({ 'name': 'moe', 'age': 40 }, ['age']); +result = _.omit({ 'name': 'moe', 'age': 40 }, function(value) { + return typeof value == 'number'; +}); + //////////////////////////////////////////////////////////////////////////////////////// //WHAT'S LEFT //////////////////////////////////////////////////////////////////////////////////////// diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 68037960cc..6e380cffc1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2612,9 +2612,34 @@ declare module _ { callback?: (objectValue: any, sourceValue: any) => any, thisArg?: any): any; - + /** + * Creates a shallow clone of object excluding the specified properties. Property names may be + * specified as individual arguments or as arrays of property names. If a callback is provided + * it will be executed for each property of object omitting the properties the callback returns + * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, + * object). + * @param object The source object. + * @param keys The properties to omit. + * @return An object without the omitted properties. + **/ + export function omit( + object: any, + ...keys: string[]): any; - + /** + * @see _.omit + **/ + export function omit( + object: any, + keys: string[]): any; + + /** + * @see _.omit + **/ + export function omit( + object: any, + callback: (value: any) => boolean, + thisArg?: any): any; @@ -2684,22 +2709,7 @@ declare module _ { object: any, ...keys: string[]): any; - /** - * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). - * @param object Object to strip unwanted key/value pairs. - * @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; - - /** - * @see _.omit - **/ - export function omit( - object: any, - keys: string[]): any; + /** * Invokes interceptor with the object, and then returns object. The primary purpose of this method