Travis build: 1304

This commit is contained in:
30secondsofcode
2018-01-18 15:42:28 +00:00
parent a39d7c88f4
commit a6cced8f05
5 changed files with 66 additions and 51 deletions

View File

@ -5,15 +5,15 @@ Flip takes a function as an argument, then makes the first argument the last.
Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.
```js
const flip = fn => (first, ...rest) => fn(...rest, first);
const flip = fn => (first, ...rest) => fn(...rest, first);
```
```js
let a = { name: 'John Smith' };
let b = {};
const mergeFrom = flip(Object.assign);
let mergePerson = mergeFrom.bind(null, a);
mergePerson(b); // == b
b = {};
Object.assign(b, a); // == b
let a = { name: 'John Smith' };
let b = {};
const mergeFrom = flip(Object.assign);
let mergePerson = mergeFrom.bind(null, a);
mergePerson(b); // == b
b = {};
Object.assign(b, a); // == b
```

View File

@ -16,6 +16,6 @@ const get = (from, ...selectors) =>
```
```js
const obj = { selector: { to: { val: 'val to select' } }, target: [1, 2, {a: 'test'}] };
const obj = { selector: { to: { val: 'val to select' } }, target: [1, 2, { a: 'test' }] };
get(obj, 'selector.to.val', 'target[0]', 'target[2].a'); // ['val to select', 1, 'test']
```