@common.js/time-span 5.1.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +18 -5
  2. package/readme.md +0 -52
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@common.js/time-span",
3
- "version": "5.1.0",
4
- "description": "Simplified high resolution timing",
3
+ "version": "5.1.1",
4
+ "description": "time-span package exported as CommonJS modules",
5
5
  "license": "MIT",
6
6
  "repository": "etienne-martin/common.js",
7
7
  "funding": "https://github.com/sponsors/sindresorhus",
8
8
  "type": "commonjs",
9
+ "exports": {
10
+ "types": "./index.d.ts",
11
+ "node": "./index.js",
12
+ "default": "./browser.js"
13
+ },
9
14
  "engines": {
10
15
  "node": ">=12"
11
16
  },
@@ -18,7 +23,7 @@
18
23
  "index.d.ts"
19
24
  ],
20
25
  "dependencies": {
21
- "@common.js/convert-hrtime": "^5.0.0"
26
+ "convert-hrtime": "npm:@common.js/convert-hrtime@5.0.1"
22
27
  },
23
28
  "devDependencies": {
24
29
  "ava": "^3.15.0",
@@ -28,7 +33,15 @@
28
33
  "xo": "^0.38.2"
29
34
  },
30
35
  "homepage": "https://github.com/etienne-martin/common.js#readme",
31
- "types": "./index.d.ts",
36
+ "commonjs": {
37
+ "source": {
38
+ "name": "time-span",
39
+ "version": "5.1.0"
40
+ },
41
+ "transformRevision": 1,
42
+ "buildKey": "3ebbaa8e49307aa744e7d5834ff786be518989e4a2c5d8a158588d8e625c7e55"
43
+ },
44
+ "browser": "./browser.js",
32
45
  "main": "./index.js",
33
- "browser": "./browser.js"
46
+ "types": "./index.d.ts"
34
47
  }
package/readme.md DELETED
@@ -1,52 +0,0 @@
1
- # time-span
2
-
3
- > Simplified high resolution timing
4
-
5
- Uses [`process.hrtime`](https://nodejs.org/api/process.html#processhrtimebigint) in Node.js and [`performance.now`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) in browsers ([accurate to 5 microseconds](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp)).
6
-
7
- ## Install
8
-
9
- ```
10
- $ npm install time-span
11
- ```
12
-
13
- ## Usage
14
-
15
- ```js
16
- import timeSpan from 'time-span';
17
-
18
- const end = timeSpan();
19
-
20
- timeConsumingFn();
21
-
22
- console.log(end());
23
- //=> 1745.3186
24
-
25
- console.log(end.rounded());
26
- //=> 1745
27
-
28
- console.log(end.seconds());
29
- //=> 1.7453186
30
- ```
31
-
32
- ## API
33
-
34
- ### `const end = timeSpan()`
35
-
36
- Returns a function, that when called, returns the time difference.
37
-
38
- #### end()
39
-
40
- Elapsed milliseconds.
41
-
42
- #### end.rounded()
43
-
44
- Elapsed milliseconds rounded.
45
-
46
- #### end.seconds()
47
-
48
- Elapsed seconds.
49
-
50
- #### end.nanoseconds()
51
-
52
- Elapsed nanoseconds.