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

get [object Object] in sandbox #278

Closed
FanShiDe opened this issue Aug 8, 2022 · 2 comments
Closed

get [object Object] in sandbox #278

FanShiDe opened this issue Aug 8, 2022 · 2 comments

Comments

@FanShiDe
Copy link

FanShiDe commented Aug 8, 2022

I'm running code in sandbox provided by vm2

const classnames = require('classnames')

function test() {
  var a = { name: true };
  const result = classnames(a)

  console.log('result', result)
}

test();

Because of vm2 provide proteced object, so the code arg.toString === Object.prototype.toString will get false

if (arg.toString === Object.prototype.toString) {

I think that should to be changed to arg.hasOwnProperty('toString') && typeof arg.toString === 'function', so that compatible with various running environments

@LassazVegaz
Copy link

I am working on this

@dcousens
Copy link
Collaborator

Fixed in #281

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

3 participants