From d02ced8af65f8255be96cb31c61db6f8b643f16f Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 27 Apr 2020 07:09:03 -0600 Subject: [PATCH] doc: add util.types.isArrayBufferView() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function was added by nodejs/node#15663, but was never documented. This commit documents it. PR-URL: https://github.com/nodejs/node/pull/33092 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Masashi Hirano Reviewed-By: Juan José Arboleda Reviewed-By: Andrey Pechkurov --- doc/api/util.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/api/util.md b/doc/api/util.md index 757c6a48f6ece9..567ac5f7523260 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1259,6 +1259,25 @@ util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true ``` +### `util.types.isArrayBufferView(value)` + + +* `value` {any} +* Returns: {boolean} + +Returns `true` if the value is an instance of one of the [`ArrayBuffer`][] +views, such as typed array objects or [`DataView`][]. Equivalent to +[`ArrayBuffer.isView()`][]. + +```js +util.types.isArrayBufferView(new Int8Array()); // true +util.types.isArrayBufferView(Buffer.from('hello world')); // true +util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true +util.types.isArrayBufferView(new ArrayBuffer()); // false +``` + ### `util.types.isArgumentsObject(value)`