Travis build: 1346

This commit is contained in:
30secondsofcode
2018-01-23 18:18:38 +00:00
parent 93347a4030
commit 667b871621
4 changed files with 86 additions and 7 deletions

View File

@ -6,12 +6,10 @@ Use `Object.keys(source)` to get all the keys of the second object, then `Array.
```js
const matches = (obj, source) =>
Object.keys(source).every(
key => obj.hasOwnProperty(key) && obj[key] === source[key]
);
Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]);
```
```js
matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true }) // true
matches({ hair: 'long', beard: true }, { age: 25, hair: 'long', beard: true }) // false
matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true }); // true
matches({ hair: 'long', beard: true }, { age: 25, hair: 'long', beard: true }); // false
```