Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ES6 syntax #73

Merged
merged 1 commit into from
Feb 27, 2022
Merged

use ES6 syntax #73

merged 1 commit into from
Feb 27, 2022

Conversation

davidchambers
Copy link
Member

@davidchambers davidchambers requested a review from a team January 20, 2022 11:58
Comment on lines -337 to +299
var def = $.create ({checkTypes: true, env: $.env});
return (Object.keys (_)).reduce (function(int, name) {
int[name] = def (name) ({}) (_[name].types) (_[name].impl);
{
const def = $.create ({checkTypes: true, env: $.env});
const int = {Int, NonZeroInt};
for (const name of Object.keys (_)) {
const {types, impl} = _[name];
int[name] = def (name) ({}) (types) (impl);
}
return int;
}, {Int: Int, NonZeroInt: NonZeroInt});
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this imperative approach, now that we have access to block-scoped variables.

I did not use Object.entries as it was not specified in ES6.

@davidchambers davidchambers merged commit bb59f20 into master Feb 27, 2022
@davidchambers davidchambers deleted the davidchambers/es6 branch February 27, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants