assert-is-equal-uint8array

Test if two arguments are both Uint8Arrays and have equal values.

https://github.com/cheetos319/assert-is-equal-uint8array

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.0%) to scientific vocabulary

Keywords

assert assertion check equal is isequal isstrictequal javascript nodejs same stdlib strict type util utilities utility utils valid
Last synced: 6 months ago · JSON representation ·

Repository

Test if two arguments are both Uint8Arrays and have equal values.

Basic Info
  • Host: GitHub
  • Owner: Cheetos319
  • License: apache-2.0
  • Language: JavaScript
  • Default Branch: main
  • Size: 46.9 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
assert assertion check equal is isequal isstrictequal javascript nodejs same stdlib strict type util utilities utility utils valid
Created 9 months ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

assert-is-equal-uint8array 🛠️

Version License npm

Overview

The assert-is-equal-uint8array library provides a simple and efficient way to test if two arguments are both Uint8Arrays and if they have equal values. This utility is essential for developers who work with binary data in JavaScript, particularly in environments like Node.js.

Table of Contents

Installation

To get started with assert-is-equal-uint8array, you need to install it via npm. Run the following command in your terminal:

bash npm install assert-is-equal-uint8array

Usage

Once installed, you can use the library in your JavaScript or Node.js projects. Here’s a simple example:

```javascript const assertIsEqualUint8Array = require('assert-is-equal-uint8array');

const array1 = new Uint8Array([1, 2, 3]); const array2 = new Uint8Array([1, 2, 3]); const array3 = new Uint8Array([4, 5, 6]);

console.log(assertIsEqualUint8Array(array1, array2)); // true console.log(assertIsEqualUint8Array(array1, array3)); // false ```

Example Scenarios

  1. Equal Uint8Arrays: When two Uint8Arrays have the same values, the function returns true.
  2. Different Uint8Arrays: If the values differ, it returns false.
  3. Type Checking: If either argument is not a Uint8Array, the function will throw an error.

API

assertIsEqualUint8Array(arr1, arr2)

  • Parameters:

    • arr1 - The first Uint8Array to compare.
    • arr2 - The second Uint8Array to compare.
  • Returns:

    • true if both arrays are equal.
    • false if they are not equal.
    • Throws an error if either argument is not a Uint8Array.

Example

javascript try { assertIsEqualUint8Array(new Uint8Array([1, 2]), new Uint8Array([1, 2])); // true assertIsEqualUint8Array(new Uint8Array([1, 2]), [1, 2]); // Error } catch (error) { console.error(error.message); }

Contributing

We welcome contributions to improve assert-is-equal-uint8array. If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature/YourFeature).
  6. Open a pull request.

Please ensure your code follows the project's coding standards and includes appropriate tests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

For the latest updates and versions, please visit the Releases section. You can download the latest version and execute it in your project.

Releases

Topics

This library covers a variety of topics, making it a versatile tool for developers:

  • assert: Useful for testing conditions in your code.
  • assertion: A fundamental part of testing frameworks.
  • check: Provides a simple way to verify data types.
  • equal: Focuses on equality checks for Uint8Arrays.
  • is: Simple checks for data types.
  • javascript: Works seamlessly with JavaScript environments.
  • node: Ideal for Node.js applications.
  • utilities: Provides utility functions for data handling.
  • valid: Ensures data validity in applications.

Conclusion

The assert-is-equal-uint8array library is a straightforward solution for checking equality between Uint8Arrays. With its easy-to-use API and clear functionality, it is an excellent addition to any JavaScript or Node.js project.

For more details and updates, check the Releases section.

Owner

  • Login: Cheetos319
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 399
  • Create event: 2
Last Year
  • Push event: 399
  • Create event: 2

Dependencies

package.json npm
  • @stdlib/array-typed ^0.3.0 development
  • @stdlib/array-uint8 ^0.2.2 development
  • @stdlib/array-zero-to ^0.2.2 development
  • @stdlib/assert-is-boolean ^0.2.2 development
  • @stdlib/bench-harness ^0.2.2 development
  • @stdlib/math-base-special-pow ^0.3.0 development
  • istanbul ^0.4.1 development
  • tap-min git+https://github.com/Planeshifter/tap-min.git development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/array-base-assert-has-equal-values github:stdlib-js/array-base-assert-has-equal-values#main
  • @stdlib/assert-is-uint8array ^0.2.2