File tree 5 files changed +10
-6
lines changed
5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
"use strict"
2
2
3
- const Promise = require ( 'bluebird' ) ;
3
+ const Promise = require ( 'bluebird' )
4
4
5
5
function deferAll ( obj ) {
6
6
const o = { }
Original file line number Diff line number Diff line change @@ -27,9 +27,13 @@ $.formatTime = arr => {
27
27
28
28
/**
29
29
* Get the current time!
30
- * @return {String } Formatted as `HH:MM :ss`.
30
+ * @return {String } Formatted as `[ HH:mm :ss] `.
31
31
*/
32
- $ . getTime = ( ) => new Date ( ) . toTimeString ( "UTC" ) . match ( / [ ^ \s ] + / ) [ 0 ]
32
+ const pad = n => ( n < 10 ? "0" + n : n )
33
+ $ . getTime = ( ) => {
34
+ const d = new Date ( )
35
+ return `[${ pad ( d . getHours ( ) ) } :${ pad ( d . getMinutes ( ) ) } :${ pad ( d . getSeconds ( ) ) } ]`
36
+ }
33
37
34
38
/**
35
39
* Check if value is unique within the group. Modify if is not.
Original file line number Diff line number Diff line change 1
1
"use strict"
2
2
3
3
const p = require ( "path" )
4
- const isObject = require ( "./fn" ) . isObject
5
4
const flatten = require ( "./fn" ) . flatten
5
+ const isObject = require ( "./fn" ) . isObject
6
6
const co = require ( "bluebird" ) . coroutine
7
7
const $ = require ( "./utils" )
8
8
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ function stamp() {
31
31
// }
32
32
33
33
// print the curr time.
34
- process . stdout . write ( `[ ${ clor [ this . color ] ( getTime ( ) ) } ] ` )
34
+ process . stdout . write ( clor [ this . color ] ( getTime ( ) ) + " " )
35
35
36
36
// apply arguments to `console` method
37
37
console [ this . method ] . apply ( console , ( this . custom ? [ this . custom ] . concat ( args ) : args ) )
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ test("fn.getTime", t => {
82
82
const out = $ . getTime ( )
83
83
t . equal ( typeof out , "string" , "returns a string" )
84
84
t . equal ( out . split ( ":" ) . length , 3 , "has 3 segments" )
85
- t . equal ( out . length , 8 , "is always 8 characters long" )
85
+ t . equal ( out . length , 10 , "is always 10 characters long" )
86
86
t . end ( )
87
87
} )
88
88
You can’t perform that action at this time.
0 commit comments