(#19272) Add has_element() function#130
Merged
jeffmccune merged 1 commit intopuppetlabs:masterfrom Feb 15, 2013
Merged
Conversation
It is exceptionally difficult to determine if an array contains an element matching a specific value without an iteration or loop construct. This function is the Puppet equivalent of Array.includes?(foo) in Ruby. The implementation is a verbatim copy of has_key() with the minor modifications needed to support arrays instead of hashes.
Contributor
|
This looks great. Thanks for the contribution and example specs. |
jeffmccune
pushed a commit
that referenced
this pull request
Feb 15, 2013
(#19272) Add has_element() function
Contributor
|
As I commented in http://projects.puppetlabs.com/issues/19272 why is the in-expression not sufficient? I think we should really not duplicate behavior in the stdlib that the language already provides. So if there is no extra benefit to the in-expression, I would propose to revert this merge. |
jeffmccune
pushed a commit
that referenced
this pull request
Feb 15, 2013
This reverts commit f7a1818, reversing changes made to 36a7b29. I'm reverting this change because of concerns raised by Peter Meier that it duplicates the "in" operator in the DSL. The "in" operator is new information that I did not posses when I made the decision to merge. Because of this new information I'm un-merging and continuing the discussion in the comments of https://projects.puppetlabs.com/issues/19272 Reference: GH-130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is exceptionally difficult to determine if an array contains an element matching a specific value without an iteration or loop construct.
This function is the Puppet equivalent of Array.includes?(foo) in Ruby. The implementation is a verbatim copy of has_key() with the minor modifications needed to support arrays instead of hashes.