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

Introduce iterable_values() #33

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Feb 22, 2021

I was thinking an option to lose all keys might be handy. Eg. when you want to create array from iterable using your way (not using iterable_to_array().

$buffer = [];

foreach(iterable_values($iterable) as $key => $value) {
    echo 'I want to count here ' . $key . "\n";
    
    $buffer[] = $value;
}

@simPod simPod force-pushed the add-iterable-values branch from d423205 to de8ca5d Compare February 22, 2021 09:06
@codecov
Copy link

codecov bot commented Feb 22, 2021

Codecov Report

Merging #33 (f29a138) into 2.0.x-dev (a002e1f) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           2.0.x-dev       #33   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
===========================================
  Files              3         4    +1     
  Lines             39        48    +9     
===========================================
+ Hits              39        48    +9     
Impacted Files Coverage Δ
src/IterableObject.php 100.00% <100.00%> (ø)
src/WithoutKeysTraversable.php 100.00% <100.00%> (ø)
src/iterable-functions.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a002e1f...f29a138. Read the comment docs.

@simPod simPod force-pushed the add-iterable-values branch from de8ca5d to 1a64b1d Compare February 22, 2021 09:09
@bpolaszek
Copy link
Owner

bpolaszek commented Feb 22, 2021

Excellent, I was thinking about it :-)

Would you mind instead:

  • Implementing IterableObject::values()
  • Make iterable_values($iterable) as a shortcut of iterable($iterable)->values()?

(Similarly as what we did with filter / map).

Thank you! 🙏
Ben

@simPod
Copy link
Contributor Author

simPod commented Feb 22, 2021

makes sense 🆗

@simPod simPod force-pushed the add-iterable-values branch 5 times, most recently from 4ae1125 to 65ed431 Compare February 25, 2021 08:05
@simPod simPod force-pushed the add-iterable-values branch from 65ed431 to cfceadb Compare February 25, 2021 08:14
@simPod
Copy link
Contributor Author

simPod commented Feb 25, 2021

@simPod simPod force-pushed the add-iterable-values branch from cfceadb to ce8b421 Compare February 25, 2021 10:46

Verified

This commit was signed with the committer’s verified signature.
navidemad Navid EMAD
@simPod simPod force-pushed the add-iterable-values branch from ce8b421 to f29a138 Compare February 25, 2021 10:48
@bpolaszek bpolaszek merged commit 70b4a54 into bpolaszek:2.0.x-dev Feb 25, 2021
@bpolaszek
Copy link
Owner

Thank you @simPod ! 🙏

@simPod simPod deleted the add-iterable-values branch February 25, 2021 13:54
@simPod simPod mentioned this pull request Mar 11, 2021
@bpolaszek bpolaszek mentioned this pull request Mar 13, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants