File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -266,13 +266,7 @@ export class Duration {
266
266
* The string representation of this `Duration`. e.g. "645 seconds"
267
267
*/
268
268
public toString ( ) : string {
269
- return this . pluralize ( ) ;
270
- }
271
-
272
- private pluralize ( num = this . quantity , unit = this . unit ) : string {
273
- const name = Duration . Unit [ unit ] . toLowerCase ( ) ;
274
- if ( num === 1 ) return `${ num } ${ name . slice ( 0 , name . length - 1 ) } ` ;
275
- return `${ num } ${ name } ` ;
269
+ return pluralize ( this . quantity , this . unit ) ;
276
270
}
277
271
}
278
272
@@ -296,7 +290,7 @@ export namespace Duration {
296
290
*/
297
291
export type Interruptable = {
298
292
interrupt : ( ) => void ;
299
- }
293
+ } ;
300
294
301
295
/**
302
296
* A promise of result type `T` that can be interrupted prematurely, resulting in an early resolution.
@@ -358,3 +352,8 @@ export function sleep(
358
352
} ) ;
359
353
return Object . assign ( promise , { interrupt : wake } ) ;
360
354
}
355
+
356
+ const pluralize = ( num : number , unit : Duration . Unit ) : string => {
357
+ const name = Duration . Unit [ unit ] . toLowerCase ( ) ;
358
+ return `${ num } ${ num === 1 ? name . slice ( 0 , name . length - 1 ) : name } ` ;
359
+ } ;
You can’t perform that action at this time.
0 commit comments