Skip to content

Added ES6 scope and error log #1574

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

Closed
wants to merge 3 commits into from
Closed

Added ES6 scope and error log #1574

wants to merge 3 commits into from

Conversation

evenstensberg
Copy link

Added local scoping from ES6 syntax with const to static variables. Also added error log to getState function to notify if the user decides to do something tricky.

evenstensberg added 3 commits April 3, 2016 08:34
Added let to for loop scopes and an additional error log if user
decides to do something tricky
Fixed awkward typo mistake
@@ -73,7 +73,10 @@ export default function createStore(reducer, initialState, enhancer) {
function getState() {
return currentState
}


if (typeof getState !== 'function' || getState == 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getState is a locally defined function. It is guaranteed to be a function by the code unless I’m missing something.

@gaearon
Copy link
Contributor

gaearon commented Apr 4, 2016

I’m up for replacing var with const or let but we should do it consistently across the codebase, not just in a few methods. This is already being done in #1559 so I’ll close this out. Thanks for the PR!

@gaearon gaearon closed this Apr 4, 2016
@evenstensberg
Copy link
Author

Yeah, did that at first, but considering some variables were used across scopes, I left them as variables, but Mateusz covers this smoothly!

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

Successfully merging this pull request may close these issues.

2 participants