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

Avoid to redefine a property if is already defined #8

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

Avoid to redefine a property if is already defined #8

wants to merge 1 commit into from

Conversation

bud-mo
Copy link

@bud-mo bud-mo commented Sep 27, 2017

If the library is loaded many time may cause trouble when try to define a property many time.
This modification skip to define the Date.prototype.toPrunedJSON if is already defined.

If the library is loaded many time may cause trouble when try to define a property many time.
This modification skip to define the `Date.prototype.toPrunedJSON` if is already defined.
@@ -45,7 +45,9 @@
forEachProperty(Object.getPrototypeOf(obj), callback, excluded);
};

Object.defineProperty(Date.prototype, "toPrunedJSON", {value:Date.prototype.toJSON});
if (typeof Date.prototype.toPrunedJSON === "undefined") {
Copy link
Owner

Choose a reason for hiding this comment

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

Please change that to
if (Date.prototype.toPrunedJSON === undefined) {

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.

None yet

2 participants