Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

human-time

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

human-time - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

12

human.js

@@ -10,4 +10,2 @@ /**

var util = require('util');
module.exports = human;

@@ -34,8 +32,10 @@

var time = Math.floor(times[i]);
var name = names[i];
if (time > 1)
return util.format('%d %ss %s', time, names[i], suffix);
else if (time === 1)
return util.format('%d %s %s', time, names[i], suffix);
name += 's';
if (time >= 1)
return time + ' ' + name + ' ' + suffix;
}
return util.format('0 seconds %s', suffix);
return '0 seconds ' + suffix;
}
{
"name": "human-time",
"version": "0.0.1",
"version": "0.0.2",
"description": "show seconds in a human-readable form",

@@ -5,0 +5,0 @@ "main": "human.js",

@@ -7,8 +7,14 @@ #!/usr/bin/env node

var rel;
[
[600, '10 minutes ago'],
[60, '1 minute ago'],
[new Date(), '0 seconds ago']
].forEach(function (o) {
var t = o[0];
var s = o[1];
rel = human(600);
assert.equal(rel, '10 minutes ago');
var rel = human(t);
rel = human(new Date());
assert.equal(rel, '0 seconds ago');
console.log('human(%j) [%j] == %j', t, rel, s);
assert.equal(rel, s);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc