Skip to content

Commit ccfba54

Browse files
oliversalzburgdarrachequesne
authored andcommitted
refactor(buffer): replace deprecated Buffer constructor usage (#11)
BREAKING CHANGE: drop support for Node.js ≤ 4.4.x and 5.0.0 - 5.9.x See: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/
1 parent 3c846f0 commit ccfba54

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/base64id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Base64Id.prototype.getRandomBytes = function(bytes) {
7878
*/
7979

8080
Base64Id.prototype.generateId = function () {
81-
var rand = new Buffer(15); // multiple of 3 for base64
81+
var rand = Buffer.alloc(15); // multiple of 3 for base64
8282
if (!rand.writeInt32BE) {
8383
return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString()
8484
+ Math.abs(Math.random() * Math.random() * Date.now() | 0).toString();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
, "url": "https://github.com/faeldt/base64id.git"
1010
}
1111
, "main": "./lib/base64id.js"
12-
, "engines": { "node": ">= 0.4.0" }
12+
, "engines": { "node": "^4.5.0 || >= 5.9" }
1313
}

0 commit comments

Comments
 (0)