summaryrefslogtreecommitdiff
path: root/lib/internal/fs/utils.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-20 13:15:48 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-27 17:05:19 +0100
commit7bddfcc61a5a7d04583a8c4fec462ca5ce45b677 (patch)
tree0ed6a369fdb71c84281ae830b24ab78da6bce3f7 /lib/internal/fs/utils.js
parent751c92d9728da6f6f86e443783a61253791cfc2f (diff)
downloadandroid-node-v8-7bddfcc61a5a7d04583a8c4fec462ca5ce45b677.tar.gz
android-node-v8-7bddfcc61a5a7d04583a8c4fec462ca5ce45b677.tar.bz2
android-node-v8-7bddfcc61a5a7d04583a8c4fec462ca5ce45b677.zip
lib: consolidate arrayBufferView validation
There are lots of places that validate for arrayBufferView and we have multiple functions that do the same thing. Instead, move the validation into `internal/validators` so all files can use that instead. There are more functions throughout the code that do the same but it takes some more work to fully consolidate all of those. PR-URL: https://github.com/nodejs/node/pull/26809 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/fs/utils.js')
-rw-r--r--lib/internal/fs/utils.js10
1 files changed, 0 insertions, 10 deletions
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index eacc460661..99e820d294 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -14,7 +14,6 @@ const {
} = require('internal/errors');
const {
isUint8Array,
- isArrayBufferView,
isDate
} = require('internal/util/types');
const { once } = require('internal/util');
@@ -393,14 +392,6 @@ function toUnixTimestamp(time, name = 'time') {
throw new ERR_INVALID_ARG_TYPE(name, ['Date', 'Time in seconds'], time);
}
-const validateBuffer = hideStackFrames((buffer) => {
- if (!isArrayBufferView(buffer)) {
- throw new ERR_INVALID_ARG_TYPE('buffer',
- ['Buffer', 'TypedArray', 'DataView'],
- buffer);
- }
-});
-
const validateOffsetLengthRead = hideStackFrames(
(offset, length, bufferLength) => {
if (offset < 0 || offset >= bufferLength) {
@@ -453,7 +444,6 @@ module.exports = {
stringToSymlinkType,
Stats,
toUnixTimestamp,
- validateBuffer,
validateOffsetLengthRead,
validateOffsetLengthWrite,
validatePath