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

Add API for Collections (separate package?) #146

Closed
danon opened this issue Nov 11, 2022 · 0 comments
Closed

Add API for Collections (separate package?) #146

danon opened this issue Nov 11, 2022 · 0 comments

Comments

@danon
Copy link
Member

danon commented Nov 11, 2022

I would see it like this:

$collection = Collection::of($array);

Interface filtering

$collection->filter($pattern);
$collection->filterAny($patternList);
$collection->filterAll($patternList);
$collection->filterKeys($pattern);
$collection->filterKeysAny($patternList);
$collection->filterKeysAll($patternList);
$collection->filterAttribute($pattern, $attribute);
$collection->filterAttributeAny($patternList, $attribute);
$collection->filterAttributeAll($patternList, $attribute);
$collection->filterAssociative($pattern);
$collection->filterAssociativeAny($patternList);
$collection->filterAssociativeAll($patternList);

and same for reject.

Interface predicate

$collection->testAllSubjects($pattern);
$collection->testAnySubject($pattern);

$collection->testAllSubjectsAnyPattern($patternList);
$collection->testAnySubjectAnyPattern($patternList);

$collection->testAllSubjectsAllPatterns($patternList);
$collection->testAnySubjectAllPatterns($patternList);

and same for fail

@danon danon changed the title Add API for filtering collections (separate package?) Add API for Collections (separate package?) Nov 11, 2022
@danon danon closed this as completed Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant