Skip to content

Commit

Permalink
fix contrived example, both in test and in README
Browse files Browse the repository at this point in the history
  • Loading branch information
planttheidea committed Jun 6, 2019
1 parent b2cc3e7 commit 425647b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function contrivedExample(array) {
const doubleObject = reduce(doubled, (object, value) => ({
...object,
[value]: value
});
}, {});

if (someObject(doubleObject, (value) => value > 100)) {
console.log('I am large!');
Expand Down
12 changes: 8 additions & 4 deletions __tests__/__fixtures__/nested/contrived/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import { map, reduce, someObject } from '../../../../src/inline-loops.macro';

if (
someObject(
reduce(map(array, value => value * 2), (object, value) => ({
...object,
[value]: value,
})),
reduce(
map(array, value => value * 2),
(object, value) => ({
...object,
[value]: value,
}),
{},
),
value => value > 100,
)
) {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__fixtures__/nested/contrived/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ for (let _key = 0, _length = array.length, _value; _key < _length; ++_key) {
_result.push(_value * 2);
}

let _result2 = _result[0];
let _result2 = {};

for (let _key2 = 1, _length2 = _result.length, _value2; _key2 < _length2; ++_key2) {
for (let _key2 = 0, _length2 = _result.length, _value2; _key2 < _length2; ++_key2) {
_value2 = _result[_key2];
_result2 = { ..._result2,
[_value2]: _value2
Expand Down

0 comments on commit 425647b

Please sign in to comment.