5
5
var bench = require ( '@stdlib/bench' ) ;
6
6
var IS_WINDOWS = require ( '@stdlib/assert/is-windows' ) ;
7
7
var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
8
+ var fromCodePoint = require ( '@stdlib/string/from-code-point' ) ;
8
9
var pkg = require ( './../package.json' ) . name ;
9
10
var RE_BASENAME = require ( './../lib' ) ;
10
11
@@ -19,7 +20,7 @@ bench( pkg, function benchmark( b ) {
19
20
if ( IS_WINDOWS ) {
20
21
b . tic ( ) ;
21
22
for ( i = 0 ; i < b . iterations ; i ++ ) {
22
- str = 'C:\\foo\\bar\\beep\\boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
23
+ str = 'C:\\foo\\bar\\beep\\boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
23
24
out = RE_BASENAME . exec ( str ) ;
24
25
if ( ! out || ! isString ( out [ 1 ] ) ) {
25
26
b . fail ( 'should capture a basename' ) ;
@@ -29,7 +30,7 @@ bench( pkg, function benchmark( b ) {
29
30
} else {
30
31
b . tic ( ) ;
31
32
for ( i = 0 ; i < b . iterations ; i ++ ) {
32
- str = '/foo/bar/beep/boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
33
+ str = '/foo/bar/beep/boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
33
34
out = RE_BASENAME . exec ( str ) ;
34
35
if ( ! out || ! isString ( out [ 1 ] ) ) {
35
36
b . fail ( 'should capture a basename' ) ;
@@ -52,7 +53,7 @@ bench( pkg+':posix', function benchmark( b ) {
52
53
53
54
b . tic ( ) ;
54
55
for ( i = 0 ; i < b . iterations ; i ++ ) {
55
- str = '/foo/bar/beep/boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
56
+ str = '/foo/bar/beep/boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
56
57
out = RE_BASENAME . posix . exec ( str ) ;
57
58
if ( ! out || ! isString ( out [ 1 ] ) ) {
58
59
b . fail ( 'should capture a basename' ) ;
@@ -74,7 +75,7 @@ bench( pkg+':win32', function benchmark( b ) {
74
75
75
76
b . tic ( ) ;
76
77
for ( i = 0 ; i < b . iterations ; i ++ ) {
77
- str = 'C:\\foo\\bar\\beep\\boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
78
+ str = 'C:\\foo\\bar\\beep\\boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
78
79
out = RE_BASENAME . win32 . exec ( str ) ;
79
80
if ( ! out || ! isString ( out [ 1 ] ) ) {
80
81
b . fail ( 'should capture a basename' ) ;
0 commit comments