
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
time-differ
Advanced tools
Measure time difference.
Installation is done using the
npm install command:
$ npm install time-differ
via ES5:
const timeDiff = require("time-differ");
type Unit =
| "*"
| "all"
| "years"
| "months"
| "weeks"
| "days"
| "hours"
| "minutes"
| "seconds"
| "milliseconds";
Creates a new index point of time, with an option to set the Time Unit.
const timeDiff = require("time-differ");
const point = timeDiff.create("seconds");
Measure the time difference.
const timeDiff = require("time-differ");
let point = timeDiff.create("seconds");
// ..some code goes here (took 40s)
point(); // ⇆ 40s
// ..some code goes here (took 15s)
point("After some code"); // ⇆ 55s (After some code)
point = timeDiff.create("*");
// ..some code goes here
point("An example of all units."); // ⇆ 1m::20s::325ms # An example of all units.
Set the time precision (decimal places).
const timeDiff = require("time-differ");
timeDiff.precision(1);
const point = timeDiff.create("seconds");
// ..some code goes here
point("1 decimal places"); // ⇆ 4.3s # 1 decimal places
timeDiff.precision(4);
// ..some code goes here
point("1 decimal places"); // ⇆ 16.3254s # 4 decimal places
An object that is automatically generated within callback argument.
type TimeObject = {
y?: number;
mn?: number;
w?: number;
d?: number;
h?: number;
m?: number;
s?: number;
ms: number;
};
Use the difference data to create custom scenario.
const timeDiff = require("time-differ");
const point = timeDiff.create("*");
// ..some code goes here # took 15s
point((timeObject) => {
console.log(`It took ${timeObject.mn} months.`); // It took 0 months.
console.log(`It took ${timeObject.s} seconds.`); // It took 7 seconds.
});
Liav Barsheshet, LBDevelopments
FAQs
Measure time difference.
We found that time-differ demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.