-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- by ES6, `RegExp#toString` should be generic and use `.flags` property - also, old engines has incorrect flags order, related #156
- Loading branch information
Showing
20 changed files
with
158 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
require('../../modules/es6.regexp.to-string'); | ||
module.exports = function toString(it){ | ||
return RegExp.prototype.toString.call(it); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
require('../../modules/es6.regexp.to-string'); | ||
module.exports = function toString(it){ | ||
return RegExp.prototype.toString.call(it); | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
var anObject = require('./_an-object') | ||
, $flags = require('./_flags') | ||
, DESCRIPTORS = require('./_descriptors'); | ||
require('./es6.regexp.flags'); | ||
// 21.2.5.14 RegExp.prototype.toString() | ||
if(require('./_fails')(function(){ | ||
return /./.toString.call({source: 'a', flags: 'b'}) != '/a/b' | ||
}))require('./_redefine')(RegExp.prototype, 'toString', function toString(){ | ||
var R = anObject(this); | ||
return '/'.concat(R.source, '/', | ||
'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); | ||
}, true); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{module, test} = QUnit | ||
module \ES6 | ||
|
||
test 'RegExp#toString' (assert)!-> | ||
{toString} = /./ | ||
assert.isFunction toString | ||
assert.arity toString, 0 | ||
assert.name toString, \toString | ||
assert.looksNative toString | ||
assert.same String(/pattern/), '/pattern/' | ||
assert.same String(/pattern/i), '/pattern/i' | ||
assert.same String(/pattern/mi), '/pattern/im' | ||
assert.same String(/pattern/im), '/pattern/im' | ||
assert.same String(/pattern/mgi), '/pattern/gim' | ||
assert.same String(new RegExp \pattern), '/pattern/' | ||
assert.same String(new RegExp \pattern \i), '/pattern/i' | ||
assert.same String(new RegExp \pattern \mi), '/pattern/im' | ||
assert.same String(new RegExp \pattern \im), '/pattern/im' | ||
assert.same String(new RegExp \pattern \mgi), '/pattern/gim' | ||
assert.same toString.call(source: \foo, flags: \bar), '/foo/bar' | ||
assert.same toString.call({}), '/undefined/undefined' | ||
if STRICT | ||
assert.throws !-> toString.call 7 | ||
assert.throws !-> toString.call \a | ||
assert.throws !-> toString.call no | ||
assert.throws !-> toString.call null | ||
assert.throws !-> toString.call void |