get-random-values 2.0.0 → 2.1.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ ## [2.1.0](https://github.com/KenanY/get-random-values/compare/2.0.0...2.1.0) (2023-03-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * add TypeScript declarations ([9a7f39f](https://github.com/KenanY/get-random-values/commit/9a7f39fbfca6b94699024619eccebeba83babc07))
7
+
8
+ ## [2.0.0](https://github.com/KenanY/get-random-values/compare/1.2.2...2.0.0) (2022-06-25)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * Node.js v10 and v12 are no longer supported.
14
+
15
+ ### Features
16
+
17
+ * drop Node.js v10 and v12 support ([1e727b9](https://github.com/KenanY/get-random-values/commit/1e727b95bc162a7afbb6608687950101fae573ab))
18
+
19
+ ### [1.2.2](https://github.com/KenanY/get-random-values/compare/1.2.1...1.2.2) (2020-08-25)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * update copyright year to 2020 ([4761fef](https://github.com/KenanY/get-random-values/commit/4761fef0e5513b84f0ab340d22ef31d97e50ab4c))
25
+
26
+ ### [1.2.1](https://github.com/KenanY/get-random-values/compare/1.2.0...1.2.1) (2020-08-25)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **deps:** global@4.4.0 ([18f7674](https://github.com/KenanY/get-random-values/commit/18f7674e87441f5d682b27390e992e18215456ab))
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2014–2022 Kenan Yildirim <https://kenany.me/>
1
+ Copyright 2014–2023 Kenan Yildirim <https://kenany.me/>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export = getRandomValues;
2
+ /**
3
+ * @template {ArrayBufferView | null} T
4
+ * @param {T} buf
5
+ * @returns {T}
6
+ */
7
+ declare function getRandomValues<T extends ArrayBufferView | null>(buf: T): T;
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
- /** @type {Window} */
1
+ /* eslint-disable no-var, operator-linebreak */
2
+
2
3
  var window = require('global/window');
3
4
  var nodeCrypto = require('crypto');
4
5
 
@@ -20,6 +21,7 @@ function getRandomValues(buf) {
20
21
  }
21
22
  if (buf.length > 65536) {
22
23
  var e = new Error();
24
+ // @ts-expect-error
23
25
  e.code = 22;
24
26
  e.message = 'Failed to execute \'getRandomValues\' on \'Crypto\': The ' +
25
27
  'ArrayBufferView\'s byte length (' + buf.length + ') exceeds the ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-random-values",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "`window.crypto.getRandomValues` with fallback to Node.js crypto",
5
5
  "keywords": [
6
6
  "crypto"
@@ -9,7 +9,10 @@
9
9
  "license": "MIT",
10
10
  "author": "Kenan Yildirim <kenan@kenany.me> (https://kenany.me/)",
11
11
  "main": "index.js",
12
+ "types": "index.d.ts",
12
13
  "files": [
14
+ "CHANGELOG.md",
15
+ "index.d.ts",
13
16
  "index.js",
14
17
  "LICENSE.txt"
15
18
  ],
@@ -20,21 +23,36 @@
20
23
  "node": "14 || 16 || >=18"
21
24
  },
22
25
  "scripts": {
26
+ "clean": "rimraf --glob test/**/*.d.ts *.d.ts",
27
+ "lint": "eslint .",
23
28
  "release": "semantic-release",
24
- "test": "tape test/*.js"
29
+ "type-coverage": "type-coverage --at-least 100 --detail --strict",
30
+ "prebuild": "npm run clean",
31
+ "build": "tsc",
32
+ "pretest": "npm run build",
33
+ "test": "tape test/*.js",
34
+ "posttest": "npm run lint && npm run type-coverage",
35
+ "prepack": "npm run build"
25
36
  },
26
37
  "dependencies": {
27
38
  "global": "^4.4.0"
28
39
  },
29
40
  "devDependencies": {
30
- "@semantic-release/changelog": "6.0.1",
31
- "@semantic-release/git": "10.0.1",
41
+ "@kenan/eslint-config": "^10.0.1",
42
+ "@semantic-release/changelog": "^6.0.2",
43
+ "@semantic-release/git": "^10.0.1",
44
+ "@tsconfig/node14": "^1.0.3",
45
+ "@types/lodash.isfunction": "^3.0.7",
46
+ "@types/tape": "^4.13.3",
32
47
  "conventional-changelog-conventionalcommits": "^5.0.0",
33
- "is-browser": "2.1.0",
34
- "lodash.foreach": "4.5.0",
35
- "lodash.isfunction": "3.0.9",
36
- "semantic-release": "^19.0.3",
37
- "tape": "5.5.3"
48
+ "eslint": "^8.36.0",
49
+ "is-browser": "^2.1.0",
50
+ "lodash.isfunction": "^3.0.9",
51
+ "rimraf": "^4.4.1",
52
+ "semantic-release": "^20.1.3",
53
+ "tape": "^5.6.3",
54
+ "type-coverage": "^2.25.0",
55
+ "typescript": "^4.9.5"
38
56
  },
39
57
  "browser": {
40
58
  "crypto": false