Skip to content

pick_nth_selected(-1) should select the last node #109

@JEM-Mosig

Description

@JEM-Mosig

I would expect

pz.select([0, 1, 2]).at_instances_of(int).pick_nth_selected(-1)

to return the same as

pz.select([0, 1, 2]).at_instances_of(int).pick_nth_selected(2)

, but instead I get

pz.select(
  [
    0,
    1,
    2,
  ]
).at_keypaths(<0 subtrees, highlighted above>)

It'd be great if pick_nth_selected would also support negative values, as I often want to select the last item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions