-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #451 from bshifter/news-fx-keys
news: filterx keys function
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
`keys()`: Add keys Function to Retrieve Top-Level Dictionary Keys | ||
|
||
This feature introduces the keys function, which returns the top-level keys of a dictionary. It provides a simple way to inspect or iterate over the immediate keys without manually traversing the structure. | ||
|
||
- **Returns an Array of Keys**: Provides a list of dictionary keys as an array. | ||
- **Current Level Only**: Includes only the top-level keys, ignoring nested structures. | ||
- **Direct Index Access**: The resulting array supports immediate indexing for quick key retrieval. | ||
|
||
**Example**: | ||
|
||
```python | ||
dict = {"foo":{"bar":{"baz":"foobarbaz"}},"tik":{"tak":{"toe":"tiktaktoe"}}}; | ||
# empty dictionary returns [] | ||
empty = keys(json()); | ||
|
||
# accessing the top level results ["foo", "tik"] | ||
a = keys(dict); | ||
|
||
# acccessing nested levels directly results ["bar"] | ||
b = keys(dict["foo"]); | ||
|
||
# directly index the result of keys() to access specific keys is possible (returns ["foo"]) | ||
c = keys(dict)[0]; | ||
``` |