
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Tiny utility for deeply mapping object keys
Map object keys (properties) to transform an object of any shape and depth*.
* Obviously, there's such a thing as a call stack. If you're working with very large objects, you should consider mapping small subsets of the object instead.
yarn add key-mapper --save
npm install key-mapper --save
Any object supplied will be deeply mapped, including arrays of objects. Any non-object, non-array contents will be skipped over. This includes any combination (to any depth) of array of objects and objects with arrays, and so on.
km(sourceObject, _.camelCase) // => convert keys to camel case
If you want to exclude certain properties from the mapping, add an optional prefilter function. For example, omit all properties named "options". Note that this means the resulting object will not have any properties named "options", not that it skips them.
km(sourceObject, _.camelCase, omitOptions)
This is useful for working with large objects that could cause key-mapper to hit the call stack limit. You could create multiple objects, one with the keys mapped, another with just the keys you wanted to exclude, then merge them back together.
const mapped = km(sourceObject, _.camelCase, omitOptions)
// here, pickOptions does the opposite of omitOptions
const filtered = km(sourceObject, _.identity, pickOptions)
const finalForm = _.merge(filtered, mapped)
Notice how I used _.identity to leave the keys as-is so I could still deeply pick "options". #protip
FAQs
Deeply map object keys
We found that key-mapper demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.