Skip to content

Commit 695a1b8

Browse files
committed
Use variable assignment
1 parent 3963d32 commit 695a1b8

File tree

1 file changed

+14
-6
lines changed
  • lib/node_modules/@stdlib/regexp/native-function/lib

1 file changed

+14
-6
lines changed
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
'use strict';
22

3-
var re = '';
3+
// MAIN //
4+
5+
var str;
6+
var re;
7+
8+
str = '';
49

510
// Use a native function as a template:
6-
re += Function.prototype.toString.call( Function );
11+
str += Function.prototype.toString.call( Function );
712

813
// Escape special RegExp characters:
9-
re = re.replace( /([.*+?^=!:$(){}|[\]\/\\])/g, '\\$1' ); // eslint-disable-line no-useless-escape
14+
str = str.replace( /([.*+?^=!:$(){}|[\]\/\\])/g, '\\$1' ); // eslint-disable-line no-useless-escape
1015

1116
// Replace any mentions of `Function` to make template generic and replace `for ...` and additional info provided in other environments, such as Rhino.
12-
re = re.replace( /Function|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?' );
17+
str = str.replace( /Function|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?' );
1318

1419
// Bracket the regular expression:
15-
re = '^' + re + '$';
20+
str = '^' + str + '$';
21+
22+
// Create the regular expression:
23+
re = new RegExp( str );
1624

1725

1826
// EXPORTS //
1927

20-
module.exports = new RegExp( re );
28+
module.exports = re;

0 commit comments

Comments
 (0)