Skip to content

Commit

Permalink
Fix #39 - avoid tail-call issues
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Sep 29, 2020
1 parent 91e28b1 commit 628162f
Show file tree
Hide file tree
Showing 8 changed files with 83,765 additions and 17 deletions.
12 changes: 6 additions & 6 deletions cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const Primitives = (_, value) => (
typeof value === primitive ? new Primitive(value) : value
);

const revive = (input, parsed, output, $) => keys(output).reduce(
(output, key) => {
const revive = (input, parsed, output, $) => {
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
const key = ke[y];
const value = output[key];
if (value instanceof Primitive) {
const tmp = input[value];
Expand All @@ -32,10 +33,9 @@ const revive = (input, parsed, output, $) => keys(output).reduce(
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
return output;
};

const set = (known, input, value) => {
const index = Primitive(input.push(value) - 1);
Expand Down
2 changes: 1 addition & 1 deletion es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ const Primitives = (_, value) => (
typeof value === primitive ? new Primitive(value) : value
);

const revive = (input, parsed, output, $) => keys(output).reduce(
(output, key) => {
const revive = (input, parsed, output, $) => {
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
const key = ke[y];
const value = output[key];
if (value instanceof Primitive) {
const tmp = input[value];
Expand All @@ -31,10 +32,9 @@ const revive = (input, parsed, output, $) => keys(output).reduce(
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
return output;
};

const set = (known, input, value) => {
const index = Primitive(input.push(value) - 1);
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ self.Flatted = (function (exports) {
};

var revive = function revive(input, parsed, output, $) {
return keys(output).reduce(function (output, key) {
for (var ke = keys(output), length = ke.length, y = 0; y < length; y++) {
var key = ke[y];
var value = output[key];

if (value instanceof Primitive) {
Expand All @@ -39,9 +40,9 @@ self.Flatted = (function (exports) {
output[key] = $.call(output, key, tmp);
}
} else output[key] = $.call(output, key, value);
}

return output;
}, output);
return output;
};

var set = function set(known, input, value) {
Expand Down
2 changes: 1 addition & 1 deletion min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 628162f

Please sign in to comment.