The
util.types.isUint8ClampedArray() method is an inbuilt application programming interface of util module which is primarily designed to support the needs of Node.js own internal APIs.
The
util.types.isUint8ClampedArray() method is used to check if the given value is an unsigned 8-bit clamped integer array or not.
Syntax:
util.types.isUint8ClampedArray( value )
Parameters: This function accepts single parameter as mentioned above and described below:
- value: It is the value that would be checked for an unsigned 8-bit clamped integer array.
Return Value: It returns a boolean value i.e.
true if the passed value is an unsigned 8-bit clamped integer array otherwise returns
false.
Below examples illustrate the
util.types.isUint8ClampedArray() method in Node.js:
Example 1:
Output:
Object is Unsigned 8-bit clamped array object: true
Object is Unsigned 8-bit clamped array object: false
Object is Unsigned 8-bit clamped array object: false
Example 2:
Output:
Uint8ClampedArray [ 0, 128, 255, 255 ]
Object is Unsigned 8-bit clamped array object: true
Uint32Array [ 4, 25, 128 ]
Object is Unsigned 8-bit clamped array object: false
BigInt64Array [ 16n, 25n, 128n ]
Object is Unsigned 8-bit clamped array object: false
Reference: https://nodejs.org/api/util.html#util_util_types_isuint8clampedarray_value