added _.has definition

This commit is contained in:
Brian Zengel
2013-10-20 12:43:35 -04:00
parent 9ac60c8311
commit b687009d33
2 changed files with 12 additions and 10 deletions

View File

@@ -579,7 +579,9 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
});
_.functions(_);
_.methods(_);
_.methods(_);
_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
var mergeNames = {
'stooges': [

18
lodash/lodash.d.ts vendored
View File

@@ -2330,6 +2330,15 @@ declare module _ {
**/
export function methods(object: any): string[];
/**
* Checks if the specified object property exists and is a direct property, instead of an
* inherited property.
* @param object The object to check.
* @param property The property to check for.
* @return True if key is a direct property, else false.
**/
export function has(object: any, property: string): boolean;
/**
* Recursively merges own enumerable properties of the source object(s), that don't resolve
* to undefined into the destination object. Subsequent sources will overwrite property
@@ -2551,15 +2560,6 @@ declare module _ {
**/
export function tap<T>(object: T, intercepter: Function): T;
/**
* Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe
* reference to the hasOwnProperty function, in case it's been overridden accidentally.
* @param object Object to check for `key`.
* @param key The key to check for on `object`.
* @return True if `key` is a property on `object`, otherwise false.
**/
export function has(object: any, key: string): boolean;
/**
* Performs an optimized deep comparison between the two objects,
* to determine if they should be considered equal.