|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
439 bytes
|
| Line | |
|---|
| 1 | /** Used to match `RegExp` flags from their coerced string values. */
|
|---|
| 2 | var reFlags = /\w*$/;
|
|---|
| 3 |
|
|---|
| 4 | /**
|
|---|
| 5 | * Creates a clone of `regexp`.
|
|---|
| 6 | *
|
|---|
| 7 | * @private
|
|---|
| 8 | * @param {Object} regexp The regexp to clone.
|
|---|
| 9 | * @returns {Object} Returns the cloned regexp.
|
|---|
| 10 | */
|
|---|
| 11 | function cloneRegExp(regexp) {
|
|---|
| 12 | var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|---|
| 13 | result.lastIndex = regexp.lastIndex;
|
|---|
| 14 | return result;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | module.exports = cloneRegExp;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.