🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@stdlib/assert-is-uint8array

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
a

@stdlib/assert-is-uint8array

Test if a value is a Uint8Array.

0.2.2
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

82

Maintenance

100

License

Version published
Weekly downloads
444K
3.55%
Maintainers
0
Weekly downloads
 
Created

What is @stdlib/assert-is-uint8array?

@stdlib/assert-is-uint8array is a utility package that provides functionality to check if a value is a Uint8Array. This can be useful in various scenarios where type checking is necessary, especially when dealing with binary data.

What are @stdlib/assert-is-uint8array's main functionalities?

Check if a value is a Uint8Array

This feature allows you to check if a given value is a Uint8Array. In the code sample, a new Uint8Array is created and passed to the isUint8Array function, which returns true.

const isUint8Array = require('@stdlib/assert-is-uint8array');

const buffer = new Uint8Array(10);
const result = isUint8Array(buffer);
console.log(result); // true

Check if a value is not a Uint8Array

This feature allows you to check if a given value is not a Uint8Array. In the code sample, an array is passed to the isUint8Array function, which returns false.

const isUint8Array = require('@stdlib/assert-is-uint8array');

const notBuffer = [1, 2, 3];
const result = isUint8Array(notBuffer);
console.log(result); // false

Other packages similar to @stdlib/assert-is-uint8array

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts