array-base-assert-any-is-entry

Test whether at least one element in a provided array has a specified own property key-value pair.

https://github.com/vp9861908406/array-base-assert-any-is-entry

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

any array assert data entry has key-value nodejs own prop stdlib structure types validate
Last synced: 6 months ago · JSON representation ·

Repository

Test whether at least one element in a provided array has a specified own property key-value pair.

Basic Info
  • Host: GitHub
  • Owner: Vp9861908406
  • License: apache-2.0
  • Language: JavaScript
  • Default Branch: main
  • Size: 48.8 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
any array assert data entry has key-value nodejs own prop stdlib structure types validate
Created 10 months ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

Array Base Assert Any Is Entry

GitHub Release Node.js

Overview

Welcome to the Array Base Assert Any Is Entry repository. This tool helps you test whether at least one element in a provided array has a specified own property key-value pair. It is designed for developers who need a simple and effective way to validate data structures in JavaScript.

Features

  • Simple Usage: Easy to implement in your existing projects.
  • Performance: Efficiently checks arrays for specified key-value pairs.
  • Flexible: Works with any type of array and property.

Table of Contents

  1. Installation
  2. Usage
  3. API Reference
  4. Examples
  5. Contributing
  6. License
  7. Releases

Installation

To get started, you can install the package via npm. Run the following command in your terminal:

bash npm install array-base-assert-any-is-entry

Usage

Once installed, you can use the library in your JavaScript code. Here’s a basic example:

```javascript const assertAnyIsEntry = require('array-base-assert-any-is-entry');

const array = [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }, { id: 3, name: 'Charlie' } ];

const hasEntry = assertAnyIsEntry(array, 'id', 2); console.log(hasEntry); // true ```

API Reference

assertAnyIsEntry(array, key, value)

  • array: An array of objects to be checked.
  • key: The property key to look for.
  • value: The value associated with the key.

Returns: true if at least one object in the array has the specified key-value pair; otherwise, false.

Examples

Here are some more examples to illustrate the usage:

Example 1: Basic Check

```javascript const data = [ { color: 'red', size: 'small' }, { color: 'blue', size: 'medium' }, { color: 'green', size: 'large' } ];

const result = assertAnyIsEntry(data, 'color', 'blue'); console.log(result); // true ```

Example 2: No Matches

```javascript const data = [ { color: 'red', size: 'small' }, { color: 'blue', size: 'medium' } ];

const result = assertAnyIsEntry(data, 'color', 'yellow'); console.log(result); // false ```

Example 3: Complex Objects

```javascript const data = [ { user: { id: 1, name: 'Alice' }, active: true }, { user: { id: 2, name: 'Bob' }, active: false } ];

const result = assertAnyIsEntry(data, 'user', { id: 1, name: 'Alice' }); console.log(result); // false, as objects are compared by reference ```

Contributing

We welcome contributions to enhance this library. Here’s how you can help:

  1. Fork the Repository: Click on the "Fork" button at the top right corner of the page.
  2. Create a Branch: Use a descriptive name for your branch. bash git checkout -b feature/your-feature-name
  3. Make Your Changes: Implement your feature or fix.
  4. Commit Your Changes: Write clear and concise commit messages. bash git commit -m "Add feature or fix description"
  5. Push to Your Branch: bash git push origin feature/your-feature-name
  6. Open a Pull Request: Go to the original repository and click on "New Pull Request".

License

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

Releases

For the latest updates and releases, visit our Releases page. You can download the latest version and execute it in your project.

Conclusion

Thank you for checking out the Array Base Assert Any Is Entry repository. We hope this tool simplifies your data validation tasks. For any questions or issues, feel free to open an issue in the repository.

For the latest releases, please visit our Releases section.

Owner

  • Login: Vp9861908406
  • 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
  • Release event: 2
  • Push event: 558
  • Create event: 2
Last Year
  • Release event: 2
  • Push event: 558
  • Create event: 2

Dependencies

package.json npm
  • @stdlib/array-base-to-accessor-array ^0.2.2 development
  • @stdlib/array-filled ^0.2.1 development
  • @stdlib/array-filled-by ^0.2.1 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
  • @stdlib/random-base-discrete-uniform ^0.2.1 development
  • @stdlib/string-from-code-point ^0.2.2 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-is-accessor-array ^0.2.2
  • @stdlib/array-base-resolve-getter ^0.2.2
  • @stdlib/assert-has-own-property ^0.2.2
  • @stdlib/types ^0.4.3