• Jump To … +
    chain.js classList.js collection.js delegate.js extend.js has.js invoke.js isBlank.js isFunction.js isObject.js isRegExp.js isString.js isUndefined.js mapEvents.js mapSelections.js matches.js pluck.js query.js queryAll.js result.js tap.js template.js tokenize.js util.js washi.js
  • has.js

  • ¶

    Taken from Underscore, this is a predicate that identifies ownership of an attribute.

    For example:

     hasOwnProperty({}, 'foo') // => false
     hasOwnProperty(null, 'foo') // => false
     hasOwnProperty({ foo: 'bar' }, 'foo') // => true
    
    var has     = Object.prototype.hasOwnProperty;
    var isBlank = require('./isBlank');
    
    module.exports = function(obj, prop) {
  • ¶

    If the object is blank, just return false. Otherwise check for membership. This prevents errors where null or undefined are accidentally provided to hasOwnProperty

      return isBlank(obj) ? false : has.call(obj, prop);
    };