From 5d284cfd561468ef2370cf3ff98a80db664a5c20 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 18 Nov 2022 18:32:57 -0500 Subject: [PATCH] util: add isArrayBufferDetached method --- doc/api/util.md | 17 +++++++++++++++++ lib/internal/util/types.js | 17 ++++++++++++++++- lib/internal/webstreams/readablestream.js | 6 +++--- lib/internal/webstreams/util.js | 17 ++--------------- src/node_types.cc | 13 +++++++++++++ typings/internalBinding/types.d.ts | 1 + 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 69549ebd0da993..9af6b897049d39 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -2024,6 +2024,23 @@ util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true ``` +### `util.types.isArrayBufferDetached(value)` + + + +* `value` {any} +* Returns: {boolean} + +Returns `true` if the value is a built-in [`ArrayBuffer`][] and +is detached. + +```js +util.types.isArrayBufferDetached(null); // Returns false +util.types.isArrayBufferDetached(new ArrayBuffer()); // Returns false +``` + ### `util.types.isArrayBufferView(value)`