Travis build: 1196
This commit is contained in:
@ -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']
|
||||
```
|
||||
|
||||
@ -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']
|
||||
```
|
||||
|
||||
@ -36,6 +36,7 @@ const httpPost = (url, callback, data = null, err = console.error) => {
|
||||
|
||||
|
||||
|
||||
|
||||
const newPost = {
|
||||
"userId": 1,
|
||||
"id": 1337,
|
||||
|
||||
Reference in New Issue
Block a user