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

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

Fix frontend appearance

  • Property mode set to 100644
File size: 526 bytes
Line 
1import _has from './_has.js';
2import toPath from './_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.
7export default function 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}
Note: See TracBrowser for help on using the repository browser.