logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Catmandu::Fix::sort_field - sort the values of an array

Name

       Catmandu::Fix::sort_field - sort the values of an array

See Also

       Catmandu::Fix

perl v5.40.0                                       2025-01-17                     Catmandu::Fix::sort_field(3pm)

Synopsis

          # e.g. tags => ["foo", "bar","bar"]
          sort_field(tags) # tags =>  ["bar","bar","foo"]
          sort_field(tags, uniq: 1) # tags =>  ["bar","foo"]
          sort_field(tags, uniq: 1, reverse: 1) # tags =>  ["foo","bar"]
          # e.g. nums => [ 100, 1 , 10]
          sort_field(nums, numeric: 1) # nums => [ 1, 10, 100]

          #push undefined values to the end of the list (default)
          #beware: reverse has no effect on this!
          sort_field(tags,undef_position: last)

          #push undefined values to the beginning of the list
          #beware: reverse has no effect on this!
          sort_field(tags,undef_position: first)

          #remove undefined values from the list
          sort_field(tags,undef_position: delete)

See Also