Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions benchmark/util/type-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const args = {
'false-primitive': true,
'false-object': int32Array,
},
DataView: {
'true': dataView,
'false-primitive': true,
'false-object': uint8Array,
},
};

const bench = common.createBenchmark(main, {
Expand Down
5 changes: 5 additions & 0 deletions lib/internal/util/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const {
TypedArrayPrototypeGetSymbolToStringTag,
} = primordials;

function isDataView(value) {
return ArrayBufferIsView(value) && TypedArrayPrototypeGetSymbolToStringTag(value) === undefined;
}

function isTypedArray(value) {
return TypedArrayPrototypeGetSymbolToStringTag(value) !== undefined;
}
Expand Down Expand Up @@ -61,6 +65,7 @@ function isBigUint64Array(value) {
module.exports = {
...internalBinding('types'),
isArrayBufferView: ArrayBufferIsView,
isDataView,
isTypedArray,
isUint8Array,
isUint8ClampedArray,
Expand Down
1 change: 0 additions & 1 deletion src/node_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace {
V(AsyncFunction) \
V(BigIntObject) \
V(BooleanObject) \
V(DataView) \
V(Date) \
V(External) \
V(GeneratorFunction) \
Expand Down
Loading