AthennaIO / AthennaIO/Common

[Feature]: Create improved `includes()` helper

Open
#132 0 comments 0 reactions 0 assignees Claimed by @RobsonTrasel View on GitHub
feature good first issue
Dominant language
TypeScript
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### 🚀 Feature Proposal

```ts
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):

```ts
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_

Contributor guide

Open the contributing guide

Research direction

Start at the existing String helper entry points and compare the requested includesSome/includesEvery call forms with the examples in the issue. Done means both helpers accept the shown argument styles and produce the demonstrated true/false results; check open pull request #149 before starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.