object-every-in-by
Test whether all properties (own and inherited) of an object pass a test implemented by a predicate function.
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 (14.0%) to scientific vocabulary
Keywords
Repository
Test whether all properties (own and inherited) of an object pass a test implemented by a predicate function.
Basic Info
- Host: GitHub
- Owner: seko-chan
- License: apache-2.0
- Language: JavaScript
- Default Branch: main
- Size: 47.9 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
Object Every In By 🚀
Welcome to the Object Every In By repository! This project tests whether all properties of an object, both own and inherited, meet the criteria defined by a predicate function. It provides a simple and effective way to validate objects in JavaScript and Node.js applications.
Table of Contents
Introduction
In JavaScript, objects are fundamental. They hold data and functionality. However, validating their properties can be tricky. This library simplifies that process. With Object Every In By, you can easily check if all properties in an object satisfy a given condition.
Features
- Simple Validation: Quickly check if all properties pass a test.
- Own and Inherited Properties: Evaluate both types of properties.
- Flexible Predicate Function: Use any function that returns a boolean.
- Lightweight: Minimal footprint for your projects.
- Node.js Compatible: Works seamlessly in Node.js environments.
Installation
To install the package, use npm:
bash
npm install object-every-in-by
Alternatively, if you prefer yarn:
bash
yarn add object-every-in-by
Usage
To use Object Every In By, first, import the function into your project:
javascript
const objectEveryInBy = require('object-every-in-by');
Next, create an object and a predicate function to test its properties.
API
objectEveryInBy(obj, predicate)
Parameters:
obj: The object to validate.predicate: A function that takes a property value and returns a boolean.
Returns:
trueif all properties pass the test, otherwisefalse.
Examples
Basic Example
```javascript const objectEveryInBy = require('object-every-in-by');
const testObject = { a: 1, b: 2, c: 3, };
const isGreaterThanZero = value => value > 0;
const result = objectEveryInBy(testObject, isGreaterThanZero); console.log(result); // true ```
Example with Inherited Properties
```javascript function Parent() { this.inheritedProperty = 10; }
Parent.prototype.parentMethod = function() { return 'parent'; };
const child = Object.create(Parent.prototype); child.ownProperty = 5;
const isNumber = value => typeof value === 'number';
const result = objectEveryInBy(child, isNumber); console.log(result); // true ```
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch and create a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For questions or suggestions, please reach out to the maintainer:
- Name: Seko Chan
- Email: seko.chan@example.com
Thank you for checking out Object Every In By! For more details, visit the Releases section.
Let's make object validation easier together!
Owner
- Login: seko-chan
- Kind: user
- Repositories: 1
- Profile: https://github.com/seko-chan
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: 1
- Push event: 758
- Create event: 3
Last Year
- Release event: 1
- Push event: 758
- Create event: 3
Dependencies
- @stdlib/assert-is-boolean ^0.2.2 development
- @stdlib/bench-harness ^0.2.2 development
- @stdlib/math-base-assert-is-nan ^0.2.2 development
- @stdlib/random-base-randu ^0.2.1 development
- @stdlib/utils-noop ^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/assert-is-function ^0.2.2
- @stdlib/error-tools-fmtprodmsg ^0.2.2
- @stdlib/string-format ^0.2.2