has()

Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.

This function is valid in v2.0.0 to v2.23.0. This function has been downloaded 50 times.

Parameters

{Object} obj
Object whose property will be tested.
{string} name
Name of the property to test.

Returns

{boolean}
A boolean indicating whether the object has the specified property as own (not inherited) property.

Required Function

This function directly requires the following function which is included automatically:

  • alias()
    Binds a context to a given function within that context.

Requiring Functions

This function is directly required by the following functions:

  • avg()
    Finds the average of the number in an array.
  • blockify()
    Creates global variables and when the returned code is executed via eval() the global variables will be deleted and will only be included in the block in which eval() executes.
  • chain()
    Creates a chained version of a value.
  • countBy()
    Creates or augments an object, making new properties that correspond to values in the given array. Each property added will indicate how many items in the array corresponding to those property names.
  • css()
    Creates a CSS stylesheet from an JSON representation of a stylesheet.
  • deleteKeys()
    Deletes one or more keys from an object of some sort.
  • dom()
    Creates HTML DOM objects.
  • ensureAt()
    Is similar to setAt() but always ensures that the specified path will be added to the root object.
  • expandRegExp()
    Expands regular expressions by expanding the character classes. Supports [:alnum:], [:alpha:], [:digit:], [:punct:], [:space:], or [:xdigit:] and allows for addition of other character classes.
  • extend()
    Adds extra properties to an object based on the properties owned by other specified objects.
  • filter()
    Creates a new object or a new array based on the specified object array. This new array will only have the values which pass the test function.
  • findNth()
    Gets the nth value matching target in subject.
  • flatMap()
    Iterates through each item in an array or an object, passing the item to a mapping function, and flattens the result into the array or object.
  • forEach()
    Traverses all the characters in a string or all of the elements in an array or an array-like object, executing a function on each one.
  • forIn()
    Runs through all of the properties of an object, executing a function for each property found.
  • fromParams()
    Takes a serialized URL parameter string and turns it into an object.
  • get()
    Get the value of the specified property name.
  • hasKeys()
    Tests to see if all of the given property names are owned by the specified object.
  • index()
    Indexes the target object based on the items found in subject and the callback function.
  • isEmpty()
    Determines if an array, arguments list, other type of list or collection is empty. Also can be used on objects to ensure that it doesn't have any properties explicitly set.
  • jsonp()
    Adds a JSON-P script to the page to be executed once the script has been retrieved.
  • modURL()
    Modify a URL.
  • only()
    Creates a new object with only the specified keys copied from the specified object to this new object.
  • parseQS()
    Parses a URL to get the parameters specified in the query string.
  • pluck()
    Creates a copy of the given array making each item the value of the given property name.
  • rekey()
    Modifies keys of an object or augments the object with more keys for the same values.
  • removeCookie()
    Removes the specified cookie(s).
  • sample()
    Takes an array and returns a new array with some or all of the original values not usually in the same order.
  • shuffle()
    Creates a new array with the items in a random order.
  • sortBy()
    Shallow copies and sorts an array given specific criteria.
  • sub()
    Substitute values into strings where the corresponding placeholders have been entered.
  • testAt()
    Tests a given path under the given root object and returns the values at each step of that path.
  • toParams()
    Takes an object and turns it into a serialized URL parameter string.
  • uneval()
    Creates a string representation of the given object or primitive.