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

strip removes functions from objects #1

Open
ikovic opened this issue Aug 1, 2018 · 0 comments
Open

strip removes functions from objects #1

ikovic opened this issue Aug 1, 2018 · 0 comments
Labels
good first issue Good for newcomers

Comments

@ikovic
Copy link

ikovic commented Aug 1, 2018

If you use JSON.stringify and JSON.parse, any function references existing in source object will not remain in the output object. If that was the original intention, I'd suggest adding unit tests with a few cases which would document the correct behavior. If not, then I'd use Object.assign:

strip: function(object) {
  return Object.assign({}, object);
}

If IE support is needed, instead of that line of code I'd use the polyfill presented here.

@dekadentno dekadentno added the good first issue Good for newcomers label Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants