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

Match the spec properly #3

Merged
merged 2 commits into from
Dec 13, 2014
Merged

Match the spec properly #3

merged 2 commits into from
Dec 13, 2014

Conversation

mathiasbynens
Copy link
Contributor

Fixes #1 and #2.

@@ -79,12 +83,30 @@ test('shims properly', function (t) {
st.end();
});

t.test('has the correct descriptor', function (st) {
st.equal();
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops – fixed :)

@ljharb
Copy link
Member

ljharb commented Dec 12, 2014

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);
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

ljharb added a commit that referenced this pull request Dec 13, 2014
Match the spec properly: throw when not an object; make getter generic.
@ljharb ljharb merged commit bed9d31 into es-shims:master Dec 13, 2014
@mathiasbynens
Copy link
Contributor Author

👍

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.

Follow the spec
2 participants