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

undefined === isImmutable? #223

Open
bradennapier opened this issue Jun 1, 2017 · 1 comment
Open

undefined === isImmutable? #223

bradennapier opened this issue Jun 1, 2017 · 1 comment

Comments

@bradennapier
Copy link

const mutableObject = Immutable.isImmutable(undefined)
   ? Immutable.asMutable(undefined)
   : undefined

this causes an error because undefined is immutable to the isImmutable request for some reason then it fails to make it mutable (obviously).

@bradennapier
Copy link
Author

bradennapier commented Jun 1, 2017

In your source I found this

} else {
      // In JavaScript, only objects are even potentially mutable.
      // strings, numbers, null, and undefined are all naturally immutable.
      return true;
    }

which to me is an issue - my goal is to check if the item is an immutable object so i know if i need to convert it or not

seems like maybe asMutable should return an object or value that , if immutable has modified, converts it back to an untouched value. therefore could do Immutable.asMutable(undefined) and simply get back 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

No branches or pull requests

1 participant