Skip to content

Reverse Array Indexing for get() and search() #138

@merklel

Description

@merklel

Hi all,

when using dpath.get() or search(), I would find it mega useful to also getting reverse order elements from arrays, analogous to python array indexing. Currently, it seems only "forward" indexing is possible.

Example:
example object to search in: {"dummy": [1,2,3,4,5,6,7,8]}

What currently works:
dp.get(ddb_resp, 'dummy/0') --> result will be 1
dp.get(ddb_resp, 'dummy/7') --> result will be 8

What is not working, but would be useful:
dp.get(ddb_resp, 'dummy/-1') --> result will be 8

Am I missing some functionality to achieve this? Otherwise, it would be really helpful feature!

Best,
Lukas

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions