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

Support Object.prototype.* calls (such as hasOwnProperty). #10

Open
archive64 opened this issue Jan 9, 2019 · 0 comments
Open

Support Object.prototype.* calls (such as hasOwnProperty). #10

archive64 opened this issue Jan 9, 2019 · 0 comments

Comments

@archive64
Copy link

👋 Hi there!

We have code that looks like this:

import colors from 'colors.less';

function exampleUtilFunction(color) {
  if (!colors.hasOwnProperty(color)) {
    throw new Error();
  }
}

When using this mock, it fails with:

TypeError: colors.hasOwnProperty is not a function

As a quick fix, we added this code to the proxy:

if (key === 'hasOwnProperty') {
  return () => true;
}

I think it'd be nice if identity-obj-proxy supported the methods on Object.prototype. I'm happy to submit a PR if it would be accepted. :)

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

No branches or pull requests

1 participant