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.24.3. This function has been downloaded 93 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()
    Creates a function wrapper that calls the function with the given name in the given context.

Requiring Functions

This function is directly required by the following functions:

  • chain()
    Creates a chained version of a value.
  • extend()
    Adds extra properties to an object based on the properties owned by other specified objects.
  • 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.
  • get()
    Get the value of the specified property name.
  • groupBy()
    Takes an array and groups the items together based on a given hasher function.
  • pluck()
    Creates a copy of the given array making each item the value of the given property name.
  • 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.
  • sub()
    Substitute values into strings where the corresponding placeholders have been entered.