El método util.types.isBigUint64Array() del módulo util está diseñado principalmente para satisfacer las necesidades de las propias API internas de Node.js.
El método util.types.isBigUint64Array() se usa para verificar si el valor dado es un objeto BigUint64Array.
Sintaxis:
util.types.isBigUint64Array( value )
Parámetros: esta función acepta un parámetro como se mencionó anteriormente y se describe a continuación:
- valor: este es el valor que se verificaría para un objeto BigUint64Array.
Valor devuelto: este método devuelve un valor booleano, es decir, verdadero si el valor pasado es una instancia de BigUint64Array; de lo contrario, devuelve falso .
Los siguientes ejemplos ilustran el método util.types.isBigUint64Array() en Node.js:
Ejemplo 1:
// Node.js program to demonstrate the // util.types.isBigUint64Array() method // Import the util module const util = require('util'); // Checking for a big signed 64-bit integer array isBigUnsignedint64Arr = util.types.isBigUint64Array(new BigUint64Array()); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr); isBigUnsignedint64Arr = util.types.isBigUint64Array(new BigInt64Array()); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr); isBigUnsignedint64Arr = util.types.isBigUint64Array(new Int32Array()); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr);
Producción:
Object is Big Unsigned 64-bit array object: true Object is Big Unsigned 64-bit array object: false Object is Big Unsigned 64-bit array object: false
Ejemplo 2:
// Node.js program to demonstrate the // util.types.isBigUint64Array() method // Import the util module const util = require('util'); // Checking a big unsigned 64-bit integer array let bigUnsigned64Arr = new BigUint64Array([16n, 25n, 69n]); console.log(bigUnsigned64Arr); isBigUnsignedint64Arr = util.types.isBigUint64Array(bigUnsigned64Arr); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr); // Checking a big signed 64-bit integer array let bigSigned64Arr = new BigInt64Array([16n, 25n, 69n]); console.log(bigSigned64Arr); isBigUnsignedint64Arr = util.types.isBigUint64Array(bigSigned64Arr); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr); // Checking a unsigned 32-bit integer array let unsigned32Arr = new Uint32Array([16, 25, 69]); console.log(unsigned32Arr); isBigUnsignedint64Arr = util.types.isBigUint64Array(unsigned32Arr); console.log("Object is Big Unsigned 64-bit array object:", isBigUnsignedint64Arr);
Producción:
BigUint64Array [ 16n, 25n, 69n ] Object is Big Unsigned 64-bit array object: true BigInt64Array [ 16n, 25n, 69n ] Object is Big Unsigned 64-bit array object: false Uint32Array [ 16, 25, 69 ] Object is Big Unsigned 64-bit array object: false
Referencia: https://nodejs.org/api/util.html#util_util_types_isbiguint64array_value
Publicación traducida automáticamente
Artículo escrito por sayantanm19 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA