-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Match the spec properly #3
Conversation
Fixes es-shims#1 and es-shims#2.
@@ -79,12 +83,30 @@ test('shims properly', function (t) { | |||
st.end(); | |||
}); | |||
|
|||
t.test('has the correct descriptor', function (st) { | |||
st.equal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops – fixed :)
Can you separate this into three PRs? One for the throwing behavior, one for configurability, and one for being used generically? That way I can merge the first immediately. |
t.test('throws properly', function (st) { | ||
var nonObjects = ['', false, true, 42, NaN, null, undefined]; | ||
st.plan(nonObjects.length); | ||
nonObjects.forEach(function (nonObject) { | ||
st.throws(function () { RegExp.prototype.flags.call(nonObject); }, TypeError); | ||
st.throws(function () { testGenericFlags(nonObject); }, TypeError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary; the original is functionally equivalent and imo reads more clearly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is necessary: paulmillr/es6-shim#310 (comment) RegExp.prototype.flags.call({})
throws TypeError: call is not a function
since flags
is a getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhhh that makes sense. Thanks for clarifying.
Match the spec properly: throw when not an object; make getter generic.
👍 |
Fixes #1 and #2.