Socket
Socket
Sign inDemoInstall

unitimer

Package Overview
Dependencies
0
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.8.0 to 3.8.1

lib/now-browser.js

11

lib/now.js

@@ -1,6 +0,11 @@

function now() {
var t = process.hrtime();
return t[0] * 1000 + t[1] / 1000000;
var nowNode = require('./now-node');
var nowBrowser = require('./now-browser');
var now = void 0;
if (process && process.hrtime) {
now = nowNode;
} else {
now = nowBrowser;
}
module.exports = now;
{
"name": "unitimer",
"version": "3.8.0",
"version": "3.8.1",
"description": "Universal timer (Node.js and browser)",
"main": "./lib/index.js",
"browser": {
"./lib/now.js": "./lib/browser-now.js"
},
"scripts": {

@@ -10,0 +7,0 @@ "build": "babel src/ -d lib/",

@@ -8,23 +8,27 @@ # unitimer

</a>
<a href="https://standardjs.com">
<img
src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"
alt="Standard" />
</a>
<a href="https://npmcdn.com/unitimer/dist/unitimer.min.js">
<img
src="https://badge-size.herokuapp.com/WebSeed/unitimer/master/dist/unitimer.min.js.svg?compression=gzip"
alt="File size" />
</a>
Universal timer (Node.js and browser). Super simple i.e.
Universal timer for Node.js and browser:
```js
var createTimer = require('unitimer')
var timer = createTimer().start()
setTimeout(function () {
var ms = timer.stop() // ms ~= 1000.0
import createTimer from 'unitimer'
const timer = createTimer().start()
setTimeout(() => {
const ms = timer.stop() // ms ~= 1000.0
timer.log() // output to console
}, 1000)
```
Multiple timers:
```js
import createTimer from 'unitimer'
const [a, b] = createTimer(['a', 'b'])
a.start()
b.start()
// ...
```
## API

@@ -31,0 +35,0 @@

@@ -1,6 +0,11 @@

function now() {
const t = process.hrtime()
return (t[0] * 1000) + (t[1] / 1000000)
const nowNode = require('./now-node')
const nowBrowser = require('./now-browser')
let now
if (process && process.hrtime) {
now = nowNode
} else {
now = nowBrowser
}
module.exports = now
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