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

Add a compare() function

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.0.0
    • Component/s: Docs
    • Labels:
      None
    • Template:
    • Epic Link:
    • Sub-team:
    • Team:
      Platform Core
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      A {{compare(a,b)}} function has been added that returns -1, 0, or 1 depending on if a is before b, same as b, or after b. The function works with the comparable types: String, Numeric, Semver, Timestamp, and Timespan. For String comparison it is possible to ignore or take case into account.
      Show
      A {{compare(a,b)}} function has been added that returns -1, 0, or 1 depending on if a is before b, same as b, or after b. The function works with the comparable types: String, Numeric, Semver, Timestamp, and Timespan. For String comparison it is possible to ignore or take case into account.
    • QA Risk Assessment:
      Needs Assessment

      Description

      In PUP-8603, the functions min and max are added. For backwards compatibility reasons they must continue to compare values with unwanted/strange automatic type conversion. In order to give users a sane alternative those functions will accept a lambda to enable taking over the responsibility to compare. To facilitate that, a compare(a,b) function should be added that returns -1, 0, 1 depending on the order of the values.

      In addition, when compare is given two strings, it should accept a third Boolean argument to control if string comparison ignores case (true - by default), or not.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            henrik.lindberg Henrik Lindberg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support