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

Set non-enumerable for Object.prototype.clone() #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GoToLoop
Copy link

"pacman.js" can't mix up w/ other scripts which rely on for...in or Object.keys() but don't check for hasOwnProperty().

Any inclusions for built-in native objects should be accompanied by Object.defineProperty() and have its new method set to { enumerable: false }!

Here's the forum thread which has inspired this fix: :D
https://forum.Processing.org/two/discussion/13501/p5-js-crash-when-including-a-new-js-file-packman-js-in-the-same-html-file

"pacman.js" can't mix up w/ other scripts which rely on [`for...in`](https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in) or [**Object.keys()**](https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) but don't check for [**hasOwnProperty()**](https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty).
Any inclusions for built-in native objects should be accompanied by [**Object.defineProperty()**](https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) and have its new method set to `{ enumerable: false }`!
@deansimcox
Copy link

You're a legend.
+1 for including this in the repo

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