source: frontend/node_modules/underscore/cjs/has.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 542 bytes
Line 
1var _has = require('./_has.js');
2var _toPath = require('./_toPath.js');
3
4// Shortcut function for checking if an object has a given property directly on
5// itself (in other words, not on a prototype). Unlike the internal `has`
6// function, this public version can also traverse nested properties.
7function has(obj, path) {
8 path = _toPath(path);
9 var length = path.length;
10 for (var i = 0; i < length; i++) {
11 var key = path[i];
12 if (!_has(obj, key)) return false;
13 obj = obj[key];
14 }
15 return !!length;
16}
17
18module.exports = has;
Note: See TracBrowser for help on using the repository browser.