Travis build: 1196

This commit is contained in:
30secondsofcode
2018-01-11 19:20:57 +00:00
parent b80cb18d13
commit 847870ede6
5 changed files with 85 additions and 6 deletions

View File

@ -5,8 +5,7 @@ Returns an array of function property names from own enumerable properties of ob
Use `Object.keys(obj)` to iterate over the object's own properties, `Array.filter()` to keep only those that are functions.
```js
const functions = obj =>
Object.keys(obj).filter(key => typeof obj[key] === 'function');
const functions = obj => Object.keys(obj).filter(key => typeof obj[key] === 'function');
```
```js
@ -14,5 +13,5 @@ function Foo() {
this.a = () => 1;
this.b = () => 2;
}
functions(new Foo); // ['a', 'b']
functions(new Foo()); // ['a', 'b']
```

View File

@ -7,7 +7,9 @@ Use the spread operator (`...`) to combine all returned property names into one
```js
const functionsIn = obj =>
[...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))].filter(key => typeof obj[key] === 'function');
[...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))].filter(
key => typeof obj[key] === 'function'
);
```
```js
@ -16,5 +18,5 @@ function Foo() {
this.b = () => 2;
}
Foo.prototype.c = () => 3;
functionsIn(new Foo); // ['a', 'b', 'c']
functionsIn(new Foo()); // ['a', 'b', 'c']
```

View File

@ -36,6 +36,7 @@ const httpPost = (url, callback, data = null, err = console.error) => {
const newPost = {
"userId": 1,
"id": 1337,