Skip to content

[Feature]: Create improved includes() helper #132

@jlenon7

Description

@jlenon7

🚀 Feature Proposal

const value = 'hello model.id'

# Verify the existence of at least one of the values
value.athenna.includesSome('models.id', 'models.provider') // true
String.includesSome(string, 'models.id', 'models.provider') // true

# Verify the existence of all the values
value.athenna.includesEvery(['models.id', 'models.provider']) // false
String.includesEvery(string, 'models.id', 'models.provider') // false

The implementation of both helpers could be achieved by doing the following (both helpers needs to accept an array of arguments as second parameter (...args or []), where the first one will be the actual string to validate):

const value = 'hello model.id'

['models.id', 'models.provider'].some(i => value.includes(i)) // true
['models.id', 'models.provider'].every(i => value.includes(i)) // false

Motivation

Improve String helper.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions