Skip to content

Commit 04f3bcc

Browse files
committed
Use prototype method
1 parent c13a343 commit 04f3bcc

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
// MODULES //
2222

2323
var isUppercase = require( '@stdlib/assert/is-uppercase' );
24-
var replace = require( '@stdlib/string/replace' );
2524
var isfinite = require( '@stdlib/math/base/assert/is-finite' );
2625
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2726

2827
// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.
2928
var abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math
3029
var lowercase = String.prototype.toLowerCase;
3130
var uppercase = String.prototype.toUpperCase;
31+
var replace = String.prototype.replace;
3232

3333

3434
// VARIABLES //
@@ -84,19 +84,19 @@ function formatDouble( token ) {
8484
out = f.toPrecision( token.precision );
8585
}
8686
if ( !token.alternate ) {
87-
out = replace( out, RE_ZERO_BEFORE_EXP, '$1e' );
88-
out = replace( out, RE_PERIOD_ZERO_EXP, 'e');
89-
out = replace( out, RE_TRAILING_PERIOD_ZERO, '' );
87+
out = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );
88+
out = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');
89+
out = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );
9090
}
9191
break;
9292
default:
9393
throw new Error( 'invalid double notation. Value: ' + token.specifier );
9494
}
95-
out = replace( out, RE_EXP_POS_DIGITS, 'e+0$1' );
96-
out = replace( out, RE_EXP_NEG_DIGITS, 'e-0$1' );
95+
out = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );
96+
out = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );
9797
if ( token.alternate ) {
98-
out = replace( out, RE_ONLY_DIGITS, '$1.' );
99-
out = replace( out, RE_DIGITS_BEFORE_EXP, '$1.e' );
98+
out = replace.call( out, RE_ONLY_DIGITS, '$1.' );
99+
out = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );
100100
}
101101
if ( f >= 0 && token.sign ) {
102102
out = token.sign + out;

0 commit comments

Comments
 (0)