Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9482

add index function to return index/key in array/hash/string and other iterables

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.3.0
    • None
    • New Feature
    • An `index()` function has been added to puppet that can return the index/key in an Array, Hash, String or other iterable value that is either equal to a given value or for which a given lambda returns a truthy value. Earlier this was difficult to do.
    • Needs Assessment

    Description

      add an array_index function which returns the index of a specified element in an array,

      see the solution in: https://ask.puppet.com/question/4763/how-to-get-an-array-index-in-manifest/

      e.g.

      $array = ['a', 'b', 'c']
      array_index($array, 'b') # returns 1
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            x2a 0x2A
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support