Socket
Socket
Sign inDemoInstall

time-span

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

index.d.ts

15

index.js
'use strict';
const convertHrtime = require('convert-hrtime');
module.exports = () => {
const timeSpan = () => {
const start = process.hrtime();
const end = type => convertHrtime(process.hrtime(start))[type];
const ret = () => end('milliseconds');
ret.rounded = () => Math.round(end('milliseconds'));
ret.seconds = () => end('seconds');
ret.nanoseconds = () => end('nanoseconds');
const returnValue = () => end('milliseconds');
returnValue.rounded = () => Math.round(end('milliseconds'));
returnValue.seconds = () => end('seconds');
returnValue.nanoseconds = () => end('nanoseconds');
return ret;
return returnValue;
};
module.exports = timeSpan;
module.exports.default = timeSpan;

94

package.json
{
"name": "time-span",
"version": "2.0.0",
"description": "Simplified high resolution timing",
"license": "MIT",
"repository": "sindresorhus/time-span",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"time",
"span",
"elapsed",
"process",
"hrtime",
"highres",
"timing",
"perf",
"performance",
"bench",
"benchmark",
"profiling",
"measure",
"seconds",
"milliseconds",
"nanoseconds"
],
"dependencies": {
"convert-hrtime": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"delay": "^2.0.0",
"in-range": "^1.0.0",
"xo": "*"
}
"name": "time-span",
"version": "3.0.0",
"description": "Simplified high resolution timing",
"license": "MIT",
"repository": "sindresorhus/time-span",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd-check"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"time",
"span",
"elapsed",
"process",
"hrtime",
"highres",
"timing",
"perf",
"performance",
"bench",
"benchmark",
"profiling",
"measure",
"seconds",
"milliseconds",
"nanoseconds"
],
"dependencies": {
"convert-hrtime": "^2.0.0"
},
"devDependencies": {
"ava": "^1.3.1",
"delay": "^4.1.0",
"in-range": "^1.0.0",
"tsd-check": "^0.3.0",
"xo": "^0.24.0"
}
}

@@ -9,3 +9,3 @@ # time-span [![Build Status](https://travis-ci.org/sindresorhus/time-span.svg?branch=master)](https://travis-ci.org/sindresorhus/time-span)

```
$ npm install --save time-span
$ npm install time-span
```

@@ -18,2 +18,3 @@

const timeSpan = require('time-span');
const end = timeSpan();

@@ -29,3 +30,3 @@

console.log(end.sec());
console.log(end.seconds());
//=> 1.7453186

@@ -37,21 +38,21 @@ ```

### timeSpan()
### `const end = timeSpan()`
Returns a function that returns the time difference:
Returns a function, that when called, returns the time difference.
#### end()
Milliseconds.
Elapsed milliseconds.
#### end.rounded()
Milliseconds rounded.
Elapsed milliseconds rounded.
#### end.seconds()
Seconds.
Elapsed seconds.
#### end.nanoseconds()
Nanoseconds.
Elapsed nanoseconds.

@@ -58,0 +59,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc