Has

has

Object.prototype.hasOwnProperty.call shortcut.

This module is one of those live examle where a tiny module can make a lot of impact in the node community.

All that this module does is helps in making a shorting function name to Object.prototype.hasOwnProperty.call as has, the code in the module is as below:

1
2
3
var bind = require('function-bind');

module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);

The impact it has made with 110 dependencies:

1
2
3
151,565 downloads in the last day
823,500 downloads in the last week
3,552,078 downloads in the last month

Get it: npm install --save has

Sample usage:

1
2
3
has({}, 'hasOwnProperty'); // false;

has(Object.prototype, 'hasOwnProperty'); // true;

Suggest a module

Comments