pretty-time
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -11,2 +11,3 @@ /*! | ||
var isNumber = require('is-number'); | ||
var nano = require('nanoseconds'); | ||
var utils = require('./utils'); | ||
@@ -25,3 +26,6 @@ var scale = { | ||
function pretty(time, smallest, digits) { | ||
if (!Array.isArray(time) || time.length !== 2) { | ||
if (!isNumber(time) && !Array.isArray(time)) { | ||
throw new TypeError('expected an array or number in nanoseconds'); | ||
} | ||
if (Array.isArray(time) && time.length !== 2) { | ||
throw new TypeError('expected an array from process.hrtime()'); | ||
@@ -35,3 +39,3 @@ } | ||
var num = ((+time[0]) * 1e9) + (+time[1]); | ||
var num = isNumber(time) ? time : nano(time); | ||
var res = ''; | ||
@@ -38,0 +42,0 @@ var prev; |
{ | ||
"name": "pretty-time", | ||
"description": "Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds.", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/pretty-time", | ||
@@ -24,3 +24,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"is-number": "^2.0.2" | ||
"is-number": "^2.0.2", | ||
"nanoseconds": "^0.1.0" | ||
}, | ||
@@ -27,0 +28,0 @@ "devDependencies": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8205
86
2
1
+ Addednanoseconds@^0.1.0
+ Addednanoseconds@0.1.0(transitive)