mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-10 20:20:12 +00:00
added _.omit definition
This commit is contained in:
@@ -669,7 +669,7 @@ var mergeAges = {
|
||||
]
|
||||
};
|
||||
|
||||
_.merge(mergeNames, mergeAges);
|
||||
result = <any>_.merge(mergeNames, mergeAges);
|
||||
|
||||
var mergeFood = {
|
||||
'fruits': ['apple'],
|
||||
@@ -681,10 +681,16 @@ var mergeOtherFood = {
|
||||
'vegetables': ['carrot']
|
||||
};
|
||||
|
||||
_.merge(mergeFood, mergeOtherFood, function(a, b) {
|
||||
result = <any>_.merge(mergeFood, mergeOtherFood, function(a, b) {
|
||||
return _.isArray(a) ? a.concat(b) : undefined;
|
||||
});
|
||||
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, 'age');
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, ['age']);
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, function(value) {
|
||||
return typeof value == 'number';
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//WHAT'S LEFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
46
lodash/lodash.d.ts
vendored
46
lodash/lodash.d.ts
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user