Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
pip install map-dictionary-keys
from map_dictionary_keys import map_dictionary_keys
d = {'some_key_to_map': 'value'}
mapped_dictionary = map_dictionary_keys(d, lambda key: key.upper())
In the above example, mapped_dictionary
will be mapped according to the function some_mapping_function
as follows:
mapped_dictionary = {'SOME_KEY_TO_MAP': 'value'}
This function will work for all levels of nested dictionaries. In the following example, both 'sub_dictionary'
and 'key_name'
will be converted as per the mapping function passed to map_dictionary_keys
.
dictionary = {
'sub_dictionary': {
'key_name': 'value'
}
}
It will also work for nested lists of dictionaries. For example, in the following example, 'key_name'
will be mapped according to the mapping function provided to map_dictionary_keys
.
dictionary = {
'list_of_dictionaries': [
{
'key_name': 'value'
}
]
}
This function will not currently work for lists nested beyond the first level. For example, in the following example, 'key_name'
will not be mapped according to the mapping function provided to map_dictionary_keys
.
dictionary = {
'my_list': [
[
{
'key_name': 'value'
}
]
]
}
FAQs
A function to map the keys in a dictionary
We found that map-dictionary-keys demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.