Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add utils/any-own-by #1851

Merged
merged 3 commits into from
Mar 17, 2024
Merged

Conversation

Rec0iL99
Copy link
Contributor

Resolves #819.

Description

What is the purpose of this pull request?

This pull request adds a utility to test whether any "own" property of a provided object satisfies a predicate function.

var anyOwnBy = require( '@stdlib/utils/any-own-by' );

function isNegative( value ) {
    return ( value < 0 );
}

var obj = {
    'a': 1,
    'b': 2,
    'c': 3,
    'd': -24,
    'e': 12
};

var bool = anyOwnBy( obj, isNegative );
// returns true

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@Planeshifter Planeshifter changed the title feat: add @stdlib/utils/any-own-by feat: add utils/any-own-by Mar 12, 2024
@Planeshifter Planeshifter added Needs Review A pull request which needs code review. Utilities Issue or pull request concerning general utilities. JavaScript Issue involves or relates to JavaScript. Feature Issue or pull request for adding a new feature. labels Mar 12, 2024
@Planeshifter Planeshifter self-requested a review March 17, 2024 03:42
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! It looked very good; made some small edits and will merge after CI has passed.

Signed-off-by: Philipp Burckhardt <[email protected]>
@Planeshifter Planeshifter merged commit 8c5698c into stdlib-js:develop Mar 17, 2024
7 checks passed
@Rec0iL99 Rec0iL99 deleted the RFC-any-own-by branch March 20, 2024 01:20
@Planeshifter Planeshifter removed the Needs Review A pull request which needs code review. label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. Utilities Issue or pull request concerning general utilities.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Add @stdlib/utils/any-own-by
3 participants