Skip to content

Commit

Permalink
feat: warn with stack
Browse files Browse the repository at this point in the history
  • Loading branch information
不四 committed May 20, 2016
1 parent e8bc10a commit 4ee1255
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
* Module dependencies.
*/

var util = require('util');
var ms = require('ms');

module.exports = function (t) {
if (typeof t === 'number') return t;
var r = ms(t);
if (r === undefined) console.warn('ms(%j) got undefined in %s', t, __filename);
if (r === undefined) {
var err = new Error(util.format('humanize-ms(%j) result undefined', t));
console.warn(err.stack);
}
return r;
};

0 comments on commit 4ee1255

Please sign in to comment.