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

for own..in #644

Merged
merged 3 commits into from
Aug 20, 2023
Merged

for own..in #644

merged 3 commits into from
Aug 20, 2023

Conversation

edemaine
Copy link
Collaborator

Yet another feature from CoffeeScript for loops:

for own key in object
↓↓↓
for (key in object) {
  if (!Object.hasOwn(object, key)) continue;

I also switched from Object.prototype.hasOwnProperty to Object.hasProp (still without using Object as an explicit name),
as recommended in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn

Also fixed up types some around this code (but there are still errors).

@edemaine edemaine temporarily deployed to build August 20, 2023 22:27 — with GitHub Actions Inactive
@edemaine edemaine temporarily deployed to build August 20, 2023 22:29 — with GitHub Actions Inactive
Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

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

Looks good, nice to see the type improvements too!

@edemaine edemaine merged commit f6dc203 into main Aug 20, 2023
2 checks passed
@edemaine edemaine deleted the for-own branch August 20, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants