Comparing version 0.2.0 to 0.2.1
31
index.js
@@ -111,20 +111,20 @@ /*! | ||
* var time = new Time(); | ||
* var diff = time.diff('foo'); | ||
* var diff = time.diff('my-app-name'); | ||
* | ||
* // do stuff | ||
* diff('foo'); | ||
* //=> 104μs | ||
* diff('after init'); | ||
* //=> [19:44:05] my-app-name: after init 108μs | ||
* | ||
* // do more stuff | ||
* diff('bar'); | ||
* //=> 1ms | ||
* diff('before options'); | ||
* //=> [19:44:05] my-app-name: before options 2ms (+2ms) | ||
* | ||
* // do more stuff | ||
* diff('baz'); | ||
* //=> 2ms | ||
* diff('after options'); | ||
* //=> [19:44:05] my-app-name: after options 2ms (+152μs) | ||
* ``` | ||
* Results in something like: | ||
* <br> | ||
* <img width="509" alt="screen shot 2016-04-13 at 7 45 12 pm" src="https://cloud.githubusercontent.com/assets/383994/14512800/478e1256-01b0-11e6-9e97-c6b625f097f7.png"> | ||
* | ||
* <img width="559" alt="screen shot 2016-04-13 at 6 17 31 pm" src="https://cloud.githubusercontent.com/assets/383994/14512156/93f0bf78-01aa-11e6-9859-8f2a4b47043d.png"> | ||
* | ||
* @param {String} `name` The name of the starting time to store. | ||
@@ -152,5 +152,2 @@ * @param {String} `options` | ||
var val; | ||
if (typeof prev !== 'undefined') { | ||
val = time.end(prev); | ||
} | ||
@@ -168,3 +165,10 @@ if (typeof opts.diffColor === 'function') { | ||
var timeDiff = magenta(time.end(name)); | ||
if (typeof prev !== 'undefined') { | ||
val = time.end(prev); | ||
} | ||
// start the next cycle | ||
time.start(msg); | ||
prev = msg; | ||
if (typeof val === 'string') { | ||
@@ -184,5 +188,2 @@ timeDiff += gray(' (+' + val + ')'); | ||
} | ||
time.start(name); | ||
prev = name; | ||
}; | ||
@@ -189,0 +190,0 @@ |
{ | ||
"name": "time-diff", | ||
"description": "Returns the formatted, high-resolution time difference between `start` and `end` times.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jonschlinkert/time-diff", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -80,3 +80,4 @@ # time-diff [![NPM version](https://img.shields.io/npm/v/time-diff.svg?style=flat)](https://www.npmjs.com/package/time-diff) [![NPM downloads](https://img.shields.io/npm/dm/time-diff.svg?style=flat)](https://npmjs.org/package/time-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/time-diff.svg?style=flat)](https://travis-ci.org/jonschlinkert/time-diff) | ||
Results in something like: | ||
<img width="559" alt="screen shot 2016-04-13 at 6 17 31 pm" src="https://cloud.githubusercontent.com/assets/383994/14512156/93f0bf78-01aa-11e6-9859-8f2a4b47043d.png"> | ||
<br> | ||
<img width="509" alt="screen shot 2016-04-13 at 7 45 12 pm" src="https://cloud.githubusercontent.com/assets/383994/14512800/478e1256-01b0-11e6-9e97-c6b625f097f7.png"> | ||
@@ -92,15 +93,15 @@ **Params** | ||
var time = new Time(); | ||
var diff = time.diff('foo'); | ||
var diff = time.diff('my-app-name'); | ||
// do stuff | ||
diff('foo'); | ||
//=> 104μs | ||
diff('after init'); | ||
//=> [19:44:05] my-app-name: after init 108μs | ||
// do more stuff | ||
diff('bar'); | ||
//=> 1ms | ||
diff('before options'); | ||
//=> [19:44:05] my-app-name: before options 2ms (+2ms) | ||
// do more stuff | ||
diff('baz'); | ||
//=> 2ms | ||
diff('after options'); | ||
//=> [19:44:05] my-app-name: after options 2ms (+152μs) | ||
``` | ||
@@ -107,0 +108,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13009
176
234