summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/smart-buffer/build/utils.js
diff options
context:
space:
mode:
authorclaudiahdz <cghr1990@gmail.com>2019-11-18 21:01:39 +0200
committerMyles Borins <mylesborins@google.com>2019-11-20 19:16:47 -0500
commita7c7c703aff362f06ef5d49451a0f79fd289910f (patch)
tree48f9d01b32d55d420f229c4889a5a61178419223 /deps/npm/node_modules/smart-buffer/build/utils.js
parenta30a9f8193ddd61dfadc2d5d79784b682027b319 (diff)
downloadandroid-node-v8-a7c7c703aff362f06ef5d49451a0f79fd289910f.tar.gz
android-node-v8-a7c7c703aff362f06ef5d49451a0f79fd289910f.tar.bz2
android-node-v8-a7c7c703aff362f06ef5d49451a0f79fd289910f.zip
deps: upgrade npm to 6.13.1
PR-URL: https://github.com/nodejs/node/pull/30533 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/smart-buffer/build/utils.js')
-rw-r--r--deps/npm/node_modules/smart-buffer/build/utils.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/deps/npm/node_modules/smart-buffer/build/utils.js b/deps/npm/node_modules/smart-buffer/build/utils.js
index 76b330cd9a..6d55981234 100644
--- a/deps/npm/node_modules/smart-buffer/build/utils.js
+++ b/deps/npm/node_modules/smart-buffer/build/utils.js
@@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+const buffer_1 = require("buffer");
/**
* Error strings
*/
@@ -24,7 +25,7 @@ exports.ERRORS = ERRORS;
* @param { String } encoding The encoding string to check.
*/
function checkEncoding(encoding) {
- if (!Buffer.isEncoding(encoding)) {
+ if (!buffer_1.Buffer.isEncoding(encoding)) {
throw new Error(ERRORS.INVALID_ENCODING);
}
}
@@ -92,4 +93,16 @@ exports.checkTargetOffset = checkTargetOffset;
function isInteger(value) {
return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
}
+/**
+ * Throws if Node.js version is too low to support bigint
+ */
+function bigIntAndBufferInt64Check(bufferMethod) {
+ if (typeof BigInt === 'undefined') {
+ throw new Error('Platform does not support JS BigInt type.');
+ }
+ if (typeof buffer_1.Buffer.prototype[bufferMethod] === 'undefined') {
+ throw new Error(`Platform does not support Buffer.prototype.${bufferMethod}.`);
+ }
+}
+exports.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check;
//# sourceMappingURL=utils.js.map \ No newline at end of file