Merge pull request #1015 from PyGeek03/master

[ENHANCEMENT] Make the example for unary clearer
This commit is contained in:
Angelos Chalaris
2019-09-03 08:28:19 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -13,5 +13,5 @@ const ary = (fn, n) => (...args) => fn(...args.slice(0, n));
```js
const firstTwoMax = ary(Math.max, 2);
[[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)); // [6, 8, 10]
```
[[2, 6, 'a'], [6, 4, 8], [10]].map(x => firstTwoMax(...x)); // [6, 6, 10]
```

View File

@ -5,5 +5,5 @@ test('ary is a Function', () => {
});
const firstTwoMax = ary(Math.max, 2);
test('Discards arguments with index >=n', () => {
expect([[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x))).toEqual([6, 8, 10]);
expect([[2, 6, 'a'], [6, 4, 8], [10]].map(x => firstTwoMax(...x))).toEqual([6, 6, 10]);
});