![]() |
VOOZH | about |
The util.types.isDataView() method method of util module is primarily designed to support the needs of Node.js own Internal APIs.
The util.types.isDataView() method is used to check if the given value is a DataView object or not.
Syntax:
util.types.isDataView(value)
Return Value: This method returns a Boolean value i.e. true if the passed value is instance of DataView otherwise returns false.
Below programs illustrate the util.types.isDataView() method in Node.js:
Example 1:
Output:
Value: DataView {
byteLength: 5,
byteOffset: 0,
buffer: ArrayBuffer { [Uint8Contents]:
<00 00 00 00 00>, byteLength: 5 }
}
Value is a DataView: true
Value: Int32Array []
Value is a DataView: false
Output:
Value: Uint8Array [ 10, 20, 30 ]
Value is a View: true
Value is a DataView: false
Value: DataView {
byteLength: 3,
byteOffset: 0,
buffer: ArrayBuffer { [Uint8Contents]:
<0a 14 1e>, byteLength: 3 }
}
Value is a View: true
Value is a DataView: true