nanoseconds
Version:
Convert the process.hrtime() array to a single nanoseconds value. This makes it easier to diff times.
16 lines (13 loc) • 364 B
JavaScript
/*!
* nanoseconds <https://github.com/jonschlinkert/nanoseconds>
*
* Copyright (c) 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
;
module.exports = function(time) {
if (!Array.isArray(time) || time.length !== 2) {
throw new TypeError('expected an array from process.hrtime()');
}
return +time[0] * 1e9 + +time[1];
};