Skip to content

Commit c4e1726

Browse files
committed
refactor to use string interpolation in @stdlib/string
1 parent a04c190 commit c4e1726

33 files changed

Lines changed: 93 additions & 60 deletions

File tree

lib/node_modules/@stdlib/string/code-point-at/benchmark/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2525
var fromCodePoint = require( '@stdlib/string/from-code-point' );
2626
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
2727
var UNICODE_MAX = require( '@stdlib/constants/unicode/max' );
28+
var format = require( '@stdlib/string/format' );
2829
var pkg = require( './../package.json' ).name;
2930
var codePointAt = require( './../lib' );
3031

@@ -68,7 +69,7 @@ bench( pkg, function benchmark( b ) {
6869
b.end();
6970
});
7071

71-
bench( pkg+'::built-in', opts, function benchmark( b ) {
72+
bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) {
7273
var out;
7374
var i;
7475

lib/node_modules/@stdlib/string/ends-with/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627
var endsWith = require( './../lib' );
2728

@@ -63,7 +64,7 @@ bench( pkg, function benchmark( b ) {
6364
b.end();
6465
});
6566

66-
bench( pkg+'::substring', function benchmark( b ) {
67+
bench( format( '%s::substring', pkg ), function benchmark( b ) {
6768
var values;
6869
var bool;
6970
var str;
@@ -90,7 +91,7 @@ bench( pkg+'::substring', function benchmark( b ) {
9091
b.end();
9192
});
9293

93-
bench( pkg+'::builtin', opts, function benchmark( b ) {
94+
bench( format( '%s::builtin', pkg ), opts, function benchmark( b ) {
9495
var values;
9596
var bool;
9697
var str;
@@ -118,7 +119,7 @@ bench( pkg+'::builtin', opts, function benchmark( b ) {
118119
b.end();
119120
});
120121

121-
bench( pkg+'::builtin,substring', opts, function benchmark( b ) {
122+
bench( format( '%s::builtin,substring', pkg ), opts, function benchmark( b ) {
122123
var values;
123124
var bool;
124125
var str;

lib/node_modules/@stdlib/string/first/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627
var first = require( './../lib' );
2728

@@ -54,7 +55,7 @@ bench( pkg, function benchmark( b ) {
5455
b.end();
5556
});
5657

57-
bench( pkg+':mode=grapheme', function benchmark( b ) {
58+
bench( format( '%s::mode=grapheme', pkg ), function benchmark( b ) {
5859
var values;
5960
var opts;
6061
var out;
@@ -84,7 +85,7 @@ bench( pkg+':mode=grapheme', function benchmark( b ) {
8485
b.end();
8586
});
8687

87-
bench( pkg+':mode=code_point', function benchmark( b ) {
88+
bench( format( '%s::mode=code_point', pkg ), function benchmark( b ) {
8889
var values;
8990
var opts;
9091
var out;
@@ -114,7 +115,7 @@ bench( pkg+':mode=code_point', function benchmark( b ) {
114115
b.end();
115116
});
116117

117-
bench( pkg+':mode=code_unit', function benchmark( b ) {
118+
bench( format( '%s::mode=code_unit', pkg ), function benchmark( b ) {
118119
var values;
119120
var opts;
120121
var out;

lib/node_modules/@stdlib/string/for-each/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627
var forEach = require( './../lib' );
2728

@@ -59,7 +60,7 @@ bench( pkg, function benchmark( b ) {
5960
}
6061
});
6162

62-
bench( pkg+':mode=grapheme', function benchmark( b ) {
63+
bench( format( '%s::mode=grapheme', pkg ), function benchmark( b ) {
6364
var values;
6465
var opts;
6566
var out;
@@ -94,7 +95,7 @@ bench( pkg+':mode=grapheme', function benchmark( b ) {
9495
}
9596
});
9697

97-
bench( pkg+':mode=code_point', function benchmark( b ) {
98+
bench( format( '%s::mode=code_point', pkg ), function benchmark( b ) {
9899
var values;
99100
var opts;
100101
var out;
@@ -129,7 +130,7 @@ bench( pkg+':mode=code_point', function benchmark( b ) {
129130
}
130131
});
131132

132-
bench( pkg+':mode=code_unit', function benchmark( b ) {
133+
bench( format( '%s::mode=code_unit', pkg ), function benchmark( b ) {
133134
var values;
134135
var opts;
135136
var out;

lib/node_modules/@stdlib/string/format/benchmark/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627
var format = require( './../lib' );
2728

@@ -50,7 +51,7 @@ bench( pkg, function benchmark( b ) {
5051
b.end();
5152
});
5253

53-
bench( pkg+'::positional', function benchmark( b ) {
54+
bench( format( '%s::positional', pkg ), function benchmark( b ) {
5455
var out;
5556
var str;
5657
var i;

lib/node_modules/@stdlib/string/from-code-point/benchmark/benchmark.apply.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var randu = require( '@stdlib/random/base/randu' );
2525
var floor = require( '@stdlib/math/base/special/floor' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var UNICODE_MAX = require( '@stdlib/constants/unicode/max' );
28+
var format = require( '@stdlib/string/format' );
2829
var pkg = require( './../package.json' ).name;
2930
var fromCodePoint = require( './../lib' );
3031

@@ -105,10 +106,10 @@ function main() {
105106
len = pow( 10, i );
106107

107108
f = createBenchmark( fromCodePoint, len );
108-
bench( pkg+'::apply:len='+len, f );
109+
bench( format( '%s::apply:len=%d', pkg, len ), f );
109110

110111
f = createBenchmark( String.fromCodePoint, len ); // eslint-disable-line node/no-unsupported-features/es-builtins
111-
bench( pkg+'::apply,built-in:len='+len, opts, f );
112+
bench( format( '%s::apply,built-in:len=%d', pkg, len ), opts, f );
112113
}
113114
}
114115

lib/node_modules/@stdlib/string/from-code-point/benchmark/benchmark.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var randu = require( '@stdlib/random/base/randu' );
2525
var floor = require( '@stdlib/math/base/special/floor' );
2626
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
2727
var UNICODE_MAX = require( '@stdlib/constants/unicode/max' );
28+
var format = require( '@stdlib/string/format' );
2829
var pkg = require( './../package.json' ).name;
2930
var fromCodePoint = require( './../lib' );
3031

@@ -59,7 +60,7 @@ bench( pkg, function benchmark( b ) {
5960
b.end();
6061
});
6162

62-
bench( pkg+'::built-in', opts, function benchmark( b ) {
63+
bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) {
6364
var out;
6465
var x;
6566
var i;

lib/node_modules/@stdlib/string/from-code-point/benchmark/benchmark.length.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
2727
var pow = require( '@stdlib/math/base/special/pow' );
2828
var UNICODE_MAX = require( '@stdlib/constants/unicode/max' );
2929
var Float64Array = require( '@stdlib/array/float64' );
30+
var format = require( '@stdlib/string/format' );
3031
var pkg = require( './../package.json' ).name;
3132
var fromCodePoint = require( './../lib' );
3233

@@ -98,7 +99,7 @@ function main() {
9899
for ( i = min; i <= max; i++ ) {
99100
len = pow( 10, i );
100101
f = createBenchmark( len );
101-
bench( pkg+':len='+len, f );
102+
bench( format( '%s::len=%d', pkg, len ), f );
102103
}
103104
}
104105

lib/node_modules/@stdlib/string/last/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627
var last = require( './../lib' );
2728

@@ -54,7 +55,7 @@ bench( pkg, function benchmark( b ) {
5455
b.end();
5556
});
5657

57-
bench( pkg+':mode=grapheme', function benchmark( b ) {
58+
bench( format( '%s::mode=grapheme', pkg ), function benchmark( b ) {
5859
var values;
5960
var opts;
6061
var out;
@@ -84,7 +85,7 @@ bench( pkg+':mode=grapheme', function benchmark( b ) {
8485
b.end();
8586
});
8687

87-
bench( pkg+':mode=code_point', function benchmark( b ) {
88+
bench( format( '%s::mode=code_point', pkg ), function benchmark( b ) {
8889
var values;
8990
var opts;
9091
var out;
@@ -114,7 +115,7 @@ bench( pkg+':mode=code_point', function benchmark( b ) {
114115
b.end();
115116
});
116117

117-
bench( pkg+':mode=code_unit', function benchmark( b ) {
118+
bench( format( '%s::mode=code_unit', pkg ), function benchmark( b ) {
118119
var values;
119120
var opts;
120121
var out;

lib/node_modules/@stdlib/string/left-pad/benchmark/benchmark.builtin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var pkg = require( './../package.json' ).name;
2627

2728

@@ -98,7 +99,7 @@ function main() {
9899
for ( i = min; i <= max; i++ ) {
99100
len = 10 * i;
100101
f = createBenchmark( len );
101-
bench( pkg+'::builtin:len='+len, opts, f );
102+
bench( format( '%s::builtin:len=%d', pkg, len ), opts, f );
102103
}
103104
}
104105

0 commit comments

Comments
 (0)