Categories

ep.inHash()

Categories: Utilities

ep.inHash( value, object )

Plugin: ep.core

Description: Search for a specified value within an object and return its key.

  • ep.inHash( value, object )

    version added: 6.11.0

    value   The value to search for.

    object   An array through which to search.

The ep.inHash()> method is similar to <<$.inArray() method. If an element within the object matches value, ep.inHash() returns the key.

  • Report the key of some elements in the object.

    Code:
    var obj = {
            'foo': 'bar',
            'fo': 'ba',
            'fruit': 'banana'
        };
    
    ep.inHash( 'bar', obj );
    // found foo
    
    ep.inHash( 'banana', obj );
    // found fruit
    
    ep.inHash( 'test', obj );
    // no found, undefined