@@ -24,7 +24,7 @@ var rescape = require( '@stdlib/utils-escape-regexp-string' );
24
24
var isFunction = require ( '@stdlib/assert-is-function' ) ;
25
25
var isString = require ( '@stdlib/assert-is-string' ) . isPrimitive ;
26
26
var isRegExp = require ( '@stdlib/assert-is-regexp' ) ;
27
- var format = require ( '@stdlib/string-format ' ) ;
27
+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
28
28
var base = require ( '@stdlib/string-base-replace' ) ;
29
29
30
30
@@ -65,15 +65,15 @@ var base = require( '@stdlib/string-base-replace' );
65
65
*/
66
66
function replace ( str , search , newval ) {
67
67
if ( ! isString ( str ) ) {
68
- throw new TypeError ( format ( 'invalid argument. First argument must be a string. Value: `%s`. ' , str ) ) ;
68
+ throw new TypeError ( format ( '1PJ3F ' , str ) ) ;
69
69
}
70
70
if ( isString ( search ) ) {
71
71
search = new RegExp ( rescape ( search ) , 'g' ) ;
72
72
} else if ( ! isRegExp ( search ) ) {
73
- throw new TypeError ( format ( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`. ' , search ) ) ;
73
+ throw new TypeError ( format ( '1PJAT ' , search ) ) ;
74
74
}
75
75
if ( ! isString ( newval ) && ! isFunction ( newval ) ) {
76
- throw new TypeError ( format ( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`. ' , newval ) ) ;
76
+ throw new TypeError ( format ( '1PJAU ' , newval ) ) ;
77
77
}
78
78
return base ( str , search , newval ) ;
79
79
}
0 commit comments