length
Version:
Time lengths for humans
18 lines (14 loc) • 392 B
JavaScript
/*jslint node: true */
;
var length = require('./'),
test = require('tap').test;
test('lengths', function (t) {
t.equal(length('5s'), 5000);
t.equal(length('5h', 's'), 18000);
t.equal(length('0.5'), 0.5);
t.equal(length('.5'), 0.5);
t.equal(length(' .5 '), 0.5);
t.equal(length(0.5), 0.5);
t.equal(length(' .5 m s '), 0.5);
t.end();
});