|
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:
552 bytes
|
| Line | |
|---|
| 1 | define(['./_has', './_toPath'], function (_has, _toPath) {
|
|---|
| 2 |
|
|---|
| 3 | // Shortcut function for checking if an object has a given property directly on
|
|---|
| 4 | // itself (in other words, not on a prototype). Unlike the internal `has`
|
|---|
| 5 | // function, this public version can also traverse nested properties.
|
|---|
| 6 | function has(obj, path) {
|
|---|
| 7 | path = _toPath(path);
|
|---|
| 8 | var length = path.length;
|
|---|
| 9 | for (var i = 0; i < length; i++) {
|
|---|
| 10 | var key = path[i];
|
|---|
| 11 | if (!_has(obj, key)) return false;
|
|---|
| 12 | obj = obj[key];
|
|---|
| 13 | }
|
|---|
| 14 | return !!length;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | return has;
|
|---|
| 18 |
|
|---|
| 19 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.