-
Notifications
You must be signed in to change notification settings - Fork 141
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
isGetter doesn't actually validate getters #59
Comments
👍 on this. Early on I was doing some pseudo-type checking on getters using |
Sure I can implement this to be a true isGetter check. I was hesitant to do it at first since its a potentially expensive operation that will happen recursively. @colindresj if you are planning to add these checks to your code I would wrap them in a flag that removes them in production code |
I can open a PR if you like. I hesitated because I didn't know if changing |
Definitely @jordangarcia. I think this kind of approach is useful in dev, where you don't care about perf. In the future, I actually think Nuclear should automatically turn this (and other dev-only helpers) off when in production, kind of like React does with PropTypes, et al. That means updating how Nuclear config is currently handled though, so definitely a different issue entirely, and for now devs should take care of this themselves. |
@colindresj yeah its something i've been thinking about as to having a I like the idea of keeping the dispatch logs in the code as something that can be configured when you instantiate a I want to think about this a bit more before we decide anything. I am currently leaning towards adding more invariant checks and then having the minified version remove them. Also: the way npm's package.json |
@jordangarcia I think React has one version for npm, but has a const ( |
In addition, React has a set of npm-specific grunt tasks for building the unminified main file with the conditional checks that @appsforartists mentioned, as well as a The directory that eventually hits NPM is here: https://github.com/facebook/react/tree/master/npm-react And the tasks for generating the files that get put in the directory are here: https://github.com/facebook/react/blob/master/grunt/tasks/npm-react.js There's a release task that eventually publishes React everywhere it needs to: https://github.com/facebook/react/blob/master/grunt/tasks/release.js |
I am a bit uncomfortable adding this stricter validation without having a good way to remove it, and that will require rethinking the Punting this to |
I think that makes sense. I'd like to have I strong isGetter method, but think a strong approach to dev builds is even more important. On Thu, Jun 4, 2015 at 1:42 PM, Jordan Garcia [email protected]
|
I'd expect
isGetter
to assert that a getter is valid (e.g. composed only of strings, optionally a trailing function, or other getters). Instead, it tests that an array ends in a function.Valid getters that fail this test
Invalid getters that pass
A more robust test
It passes all the current getter tests.
The text was updated successfully, but these errors were encountered: