Travis build: 1539
This commit is contained in:
@ -12,13 +12,15 @@ Otherwise assign the key's value to `obj` to use on the next iteration.
|
||||
Return `false` beforehand if given key list is empty.
|
||||
|
||||
```js
|
||||
|
||||
const hasKey = (obj, keys) => {
|
||||
return (keys.length > 0) && keys.every(key => {
|
||||
if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;
|
||||
obj = obj[key];
|
||||
return true;
|
||||
});
|
||||
return (
|
||||
keys.length > 0 &&
|
||||
keys.every(key => {
|
||||
if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;
|
||||
obj = obj[key];
|
||||
return true;
|
||||
})
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user