Skip to content

Commit 60c4986

Browse files
committed
Use string utility
1 parent fb7029a commit 60c4986

File tree

1 file changed

+5
-4
lines changed
  • lib/node_modules/@stdlib/regexp/basename/benchmark

1 file changed

+5
-4
lines changed

lib/node_modules/@stdlib/regexp/basename/benchmark/benchmark.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var bench = require( '@stdlib/bench' );
66
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
77
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
8+
var fromCodePoint = require( '@stdlib/string/from-code-point' );
89
var pkg = require( './../package.json' ).name;
910
var RE_BASENAME = require( './../lib' );
1011

@@ -19,7 +20,7 @@ bench( pkg, function benchmark( b ) {
1920
if ( IS_WINDOWS ) {
2021
b.tic();
2122
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';
2324
out = RE_BASENAME.exec( str );
2425
if ( !out || !isString( out[ 1 ] ) ) {
2526
b.fail( 'should capture a basename' );
@@ -29,7 +30,7 @@ bench( pkg, function benchmark( b ) {
2930
} else {
3031
b.tic();
3132
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';
3334
out = RE_BASENAME.exec( str );
3435
if ( !out || !isString( out[ 1 ] ) ) {
3536
b.fail( 'should capture a basename' );
@@ -52,7 +53,7 @@ bench( pkg+':posix', function benchmark( b ) {
5253

5354
b.tic();
5455
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';
5657
out = RE_BASENAME.posix.exec( str );
5758
if ( !out || !isString( out[ 1 ] ) ) {
5859
b.fail( 'should capture a basename' );
@@ -74,7 +75,7 @@ bench( pkg+':win32', function benchmark( b ) {
7475

7576
b.tic();
7677
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';
7879
out = RE_BASENAME.win32.exec( str );
7980
if ( !out || !isString( out[ 1 ] ) ) {
8081
b.fail( 'should capture a basename' );

0 commit comments

Comments
 (0)