Skip to content

Commit

Permalink
feat: drop Node.js v10 and v12 support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Node.js v10 and v12 are no longer supported.
  • Loading branch information
kenany committed Jun 25, 2022
1 parent 7a049fa commit 1e727b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12, 14, 16]
node-version: [14, 16, 18]
os: [ubuntu-latest]
steps:
- name: Node.js ${{ matrix.node-version }}
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/** @type {Window} */
var window = require('global/window');
var nodeCrypto = require('crypto');

/**
* @template {ArrayBufferView | null} T
* @param {T} buf
* @returns {T}
*/
function getRandomValues(buf) {
if (window.crypto && window.crypto.getRandomValues) {
return window.crypto.getRandomValues(buf);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "test"
},
"engines": {
"node": "10 || 12 || >=14"
"node": "14 || 16 || >=18"
},
"scripts": {
"release": "semantic-release",
Expand Down
5 changes: 3 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var getRandomValues = require('../');
var test = require('tape');
var isFunction = require('lodash.isfunction');
var forEach = require('lodash.foreach');
var isBrowser = require('is-browser');

var getRandomValues = require('../');

test('exports a function', function(t) {
t.plan(1);
t.ok(isFunction(getRandomValues));
Expand Down Expand Up @@ -43,7 +44,7 @@ test('throws on length >65536', function(t) {
}, new RegExp(/QuotaExceededError/));
});

test('returns arguement', function(t) {
test('returns argument', function(t) {
t.plan(1);
var argument = new Uint8Array(1024);
t.equal(getRandomValues(argument), argument);
Expand Down

0 comments on commit 1e727b9

Please sign in to comment.