@@ -24,6 +24,7 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2424var isInteger = require ( '@stdlib/assert-is-integer' ) ;
2525var isString = require ( '@stdlib/assert-is-string' ) . isPrimitive ;
2626var isObject = require ( '@stdlib/assert-is-object' ) ;
27+ var format = require ( '@stdlib/string-format' ) ;
2728var floor = require ( '@stdlib/math-base-special-floor' ) ;
2829var round = require ( '@stdlib/math-base-special-round' ) ;
2930var ceil = require ( '@stdlib/math-base-special-ceil' ) ;
@@ -54,7 +55,7 @@ function validDate( value, name ) {
5455 if ( type === 'string' ) {
5556 value = Date . parse ( value ) ;
5657 if ( value !== value ) {
57- throw new Error ( 'invalid argument. Unable to parse ' + name . toLowerCase ( ) + ' date.' ) ;
58+ throw new Error ( format ( 'invalid argument. Unable to parse %s date.' , name . toLowerCase ( ) ) ) ;
5859 }
5960 value = new Date ( value ) ;
6061 }
@@ -144,14 +145,14 @@ function datespace( start, stop, length, options ) {
144145 }
145146 if ( flg ) {
146147 if ( ! isObject ( opts ) ) {
147- throw new TypeError ( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' ) ;
148+ throw new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`.' , opts ) ) ;
148149 }
149150 if ( hasOwnProp ( opts , 'round' ) ) {
150151 if ( ! isString ( opts . round ) ) {
151- throw new TypeError ( 'invalid option. `round ` option must be a string.' ) ;
152+ throw new TypeError ( format ( 'invalid option. `%s ` option must be a string. Option: `%s`.' , 'round' , opts . round ) ) ;
152153 }
153154 if ( rounders . indexOf ( opts . round ) === - 1 ) {
154- throw new Error ( 'invalid input option. `round ` option must be one of [' + rounders . join ( ',' ) + '].' ) ;
155+ throw new Error ( format ( 'invalid option. `%s ` option must be one of [%s].' , 'round' , rounders . join ( ',' ) ) ) ;
155156 }
156157 }
157158 }
@@ -163,8 +164,8 @@ function datespace( start, stop, length, options ) {
163164 case 'ceil' :
164165 fcn = ceil ;
165166 break ;
166- default :
167167 case 'floor' :
168+ default :
168169 fcn = floor ;
169170 break ;
170171 }
0 commit comments