Skip to content

Commit 6dd2d24

Browse files
committed
Auto-generated commit
1 parent e906866 commit 6dd2d24

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2424
var isInteger = require( '@stdlib/assert-is-integer' );
2525
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
2626
var isObject = require( '@stdlib/assert-is-object' );
27+
var format = require( '@stdlib/string-format' );
2728
var floor = require( '@stdlib/math-base-special-floor' );
2829
var round = require( '@stdlib/math-base-special-round' );
2930
var 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
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"@stdlib/assert-is-string": "^0.0.x",
4444
"@stdlib/math-base-special-ceil": "^0.0.x",
4545
"@stdlib/math-base-special-floor": "^0.0.x",
46-
"@stdlib/math-base-special-round": "^0.0.x"
46+
"@stdlib/math-base-special-round": "^0.0.x",
47+
"@stdlib/string-format": "^0.0.x"
4748
},
4849
"devDependencies": {
4950
"@stdlib/assert-is-array": "^0.0.x",

0 commit comments

Comments
 (0)