wild mode: case insesitive key substring nested_lookups

This commit is contained in:
Russell Ballestrini 2017-09-25 11:19:18 -07:00
parent 8ba271daf3
commit d46f683e76
5 changed files with 58 additions and 9 deletions

View file

@ -45,6 +45,38 @@ tutorial
>>> print(nested_lookup('taco', document))
[42, 69]
wild
========
We also have a `wild` mode that treats the given `key` as a case insensitive
substring of all the keys in the document and returns any values which match.
For example:
.. code-block:: python
from nested_lookup import nested_lookup
my_document = {
'name' : 'Russell Ballestrini',
'email_address' : 'test1@example.com',
'other' : {
'secondary_email' : 'test2@example.com',
'EMAIL_RECOVERY' : 'test3@example.com',
},
},
results = nested_lookup(
key = 'mail',
document = my_document
wild = True,
)
print(results)
['test1@example.com', 'test2@example.com', 'test3@example.com']
misc
========