55var bench = require ( '@stdlib/bench' ) ;
66var IS_WINDOWS = require ( '@stdlib/assert/is-windows' ) ;
77var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
8+ var fromCodePoint = require ( '@stdlib/string/from-code-point' ) ;
89var pkg = require ( './../package.json' ) . name ;
910var RE_DIRNAME = 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_DIRNAME . exec ( str ) ;
2425 if ( ! out || ! isString ( out [ 1 ] ) ) {
2526 b . fail ( 'should capture a dirname' ) ;
@@ -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_DIRNAME . exec ( str ) ;
3435 if ( ! out || ! isString ( out [ 1 ] ) ) {
3536 b . fail ( 'should capture a dirname' ) ;
@@ -39,9 +40,8 @@ bench( pkg, function benchmark( b ) {
3940 }
4041 if ( ! out || ! isString ( out [ 1 ] ) ) {
4142 b . fail ( 'should capture a dirname' ) ;
42- } else {
43- b . pass ( 'benchmark finished' ) ;
4443 }
44+ b . pass ( 'benchmark finished' ) ;
4545 b . end ( ) ;
4646} ) ;
4747
@@ -52,7 +52,7 @@ bench( pkg+':posix', function benchmark( b ) {
5252
5353 b . tic ( ) ;
5454 for ( i = 0 ; i < b . iterations ; i ++ ) {
55- str = '/foo/bar/beep/boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
55+ str = '/foo/bar/beep/boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
5656 out = RE_DIRNAME . posix . exec ( str ) ;
5757 if ( ! out || ! isString ( out [ 1 ] ) ) {
5858 b . fail ( 'should capture a dirname' ) ;
@@ -61,9 +61,8 @@ bench( pkg+':posix', function benchmark( b ) {
6161 b . toc ( ) ;
6262 if ( ! out || ! isString ( out [ 1 ] ) ) {
6363 b . fail ( 'should capture a dirname' ) ;
64- } else {
65- b . pass ( 'benchmark finished' ) ;
6664 }
65+ b . pass ( 'benchmark finished' ) ;
6766 b . end ( ) ;
6867} ) ;
6968
@@ -74,7 +73,7 @@ bench( pkg+':win32', function benchmark( b ) {
7473
7574 b . tic ( ) ;
7675 for ( i = 0 ; i < b . iterations ; i ++ ) {
77- str = 'C:\\foo\\bar\\beep\\boop' + String . fromCharCode ( 97 + ( i % 26 ) ) + '.js' ;
76+ str = 'C:\\foo\\bar\\beep\\boop' + fromCodePoint ( 97 + ( i % 26 ) ) + '.js' ;
7877 out = RE_DIRNAME . win32 . exec ( str ) ;
7978 if ( ! out || ! isString ( out [ 1 ] ) ) {
8079 b . fail ( 'should capture a dirname' ) ;
@@ -83,8 +82,7 @@ bench( pkg+':win32', function benchmark( b ) {
8382 b . toc ( ) ;
8483 if ( ! out || ! isString ( out [ 1 ] ) ) {
8584 b . fail ( 'should capture a dirname' ) ;
86- } else {
87- b . pass ( 'benchmark finished' ) ;
8885 }
86+ b . pass ( 'benchmark finished' ) ;
8987 b . end ( ) ;
9088} ) ;
0 commit comments