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

According to ECMAScript 262, the context argument to every, forEach and ... #3

Merged

Conversation

dotnetCarpenter
Copy link
Collaborator

According to ECMAScript 262, the context argument to every, forEach and some should be undefined if not supplied. As an named argument, not supplied to a function is always undefined there should be no need to check that argument for a falsy value. Hence the function should run in an undefined context which in turn means it will run in the global context, which the caller code should be ignorant of as no context was supplied. <- CBuffer argumentation ;)
I have removed the extraneous code but found no tests to verify that CBuffer hasn't changed behavior other than my sane thinking think it should not.

…nd some should be undefined if not supplied. As an named argument not supplied to a function is always undefined there should be no need to check for that argument. Hence the function should run in an undefined context which in turn means it will run in the global context, which the caller code should be ignorant of as no context was supplied. <- CBuffer argumentation ;) I have removed the extraneous code but found no tests to verify that CBuffer hasn't changed behavior other than my sane thinking think it should not. http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18
@trevnorris
Copy link
Owner

Awesomeness. Good catch, and very well explained.

trevnorris added a commit that referenced this pull request Nov 23, 2012
Context argument should be left as undefined
@trevnorris trevnorris merged commit 07645b2 into trevnorris:master Nov 23, 2012
@dotnetCarpenter
Copy link
Collaborator Author

nice! I saw that the project had vows and installed it, but wasn't sure how
to use it. But still I haven't found any tests specific for forEach, some
and every. Must be me..

2012/11/23 Trevor Norris notifications@github.com

@dotnetCarpenter https://github.com/dotnetCarpenter Don't know if you
noticed, but if you do npm install you can then run the vows tests by
./node_modules/.bin/vows


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-10654468.

@trevnorris
Copy link
Owner

@dotnetCarpenter To run the tests just run npm test, but you're correct in that I haven't created the unit tests for those methods. That's something I'm working on now.

@dotnetCarpenter dotnetCarpenter deleted the remove-extraneous-code branch July 14, 2013 23:18
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.

None yet

2 participants