[Pkg-javascript-commits] [node-randomfill] 43/47: smarter testing of older node buffers
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:52:54 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-randomfill.
commit b52e83c09ae9d1d2b3bcf8844db86274cf98a3ef
Author: Calvin Metcalf <cmetcalf at appgeo.com>
Date: Wed Oct 18 11:55:51 2017 -0400
smarter testing of older node buffers
---
browser.js | 4 ++--
test.js | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/browser.js b/browser.js
index 7dbcbad..ce34a69 100644
--- a/browser.js
+++ b/browser.js
@@ -44,7 +44,7 @@ if ((crypto && crypto.getRandomValues) || !process.browser) {
exports.randomFillSync = oldBrowser
}
function randomFill (buf, offset, size, cb) {
- if (!Buffer.isBuffer(buf) || !(buf instanceof global.Uint8Array)) {
+ if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
}
@@ -94,7 +94,7 @@ function randomFillSync (buf, offset, size) {
if (typeof offset === 'undefined') {
offset = 0
}
- if (!Buffer.isBuffer(buf) || !(buf instanceof global.Uint8Array)) {
+ if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
}
diff --git a/test.js b/test.js
index d065cd9..eff227c 100644
--- a/test.js
+++ b/test.js
@@ -1,5 +1,6 @@
var test = require('tape')
var crypto = require('./browser')
+var Buffer = require('safe-buffer').Buffer
test('sync', function (t) {
t.test('first', function (t) {
const buf = Buffer.alloc(10)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-randomfill.git
More information about the Pkg-javascript-commits
mailing list