Skip to content

deepEqual for RegExp should compare `sticky` #284

Closed
slevithan opened this Issue Jul 17, 2012 · 2 comments

4 participants

@slevithan

The current implementation of deepEqual for RegExp objects is good. Specifically, it's great that it doesn't compare lastIndex properties. However, the current implementation ignores the /y flag and its corresponding sticky property, which should be added to the list of comparisons.

Aside: ES6 will add support for two new RegExp flags: /y and /u. The /y flag is already supported in Firefox 3+, and has the corresponding property RegExp.prototype.sticky. The /u flag will likely show up with the property name unicode, but since that's not in writing anywhere, at the moment, it would probably be best to wait until the first implementations for /u show up before comparing unicode properties.

@prathe
prathe commented Jul 17, 2012

Thanks for bringing this Steven. I will look to add support for the sticky flag.

@vivin
vivin commented Aug 8, 2012

I have a fix for this, but grunt won't run the tests because "y" is still an invalid flag and hasn't been implemented (I'm assuming in PhantomJS). Is there a way to test it? With just the change, the tests all pass, but that's because none of the RegExp tests are trying to build a regular expression with the sticky flag.

@vivin vivin added a commit that referenced this issue Aug 8, 2012
@vivin vivin issue #284
Fix to allow deepEqual to compare the "sticky" flag. Unfortunately grunt tests fail because the sticky flag hasn't been implemented and the RegExp constructor fails with an error and does not run the test cases.
bcd0950
@vivin vivin added a commit that referenced this issue Aug 8, 2012
@vivin vivin issue #284
deepEquals now examines the "sticky" property as well. Unfortunately, tests for this do not pass since the sticky flag isn't supported yet.
8480780
@vivin vivin added a commit that referenced this issue Aug 9, 2012
@vivin vivin issue #284
Removed breaking tests because using the "y" flag isn't supported in the RegExp constructor. deepEquals does look at the "sticky" flag, however.
8fa1745
@jzaefferer jzaefferer added a commit that closed this issue Aug 17, 2012
@jzaefferer jzaefferer Compare the ES6 sticky (y) property for RegExp. Can't add to tests ye…
…t. Fixes #284 - deepEqual for RegExp should compare
9e73c8a
@JamesMGreene JamesMGreene added a commit that referenced this issue Mar 7, 2013
@jzaefferer jzaefferer Compare the ES6 sticky (y) property for RegExp. Can't add to tests ye…
…t. Fixes #284 - deepEqual for RegExp should compare
5d2467d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.