Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@supercharge/map
Advanced tools
Changelog
1.5.0 - 2021-09-13
toArray()
method: converting the map to a JavaScript array containing arrays for each key-value-pair of this mapMap.from()
method to create a new Map instance. This Map.from
method aligns with JavaScript’s Array.from
or Object.fromX
methodspick(...keys)
method: creating a new map with the picked keys
uvu
and c8
instead of jest
for testingReadme
An extended Map
and the one JavaScript should have shipped
Installation · Docs · Usage
Follow @marcuspoehls and @superchargejs for updates!
The @supercharge/map
package provides an extended JavaScript Map
class. It comes with additional methods like .isEmpty()
or .map(callback)
.
You already know methods like .map()
from arrays and having them available on maps improves your development experience and makes your code more readable.
npm i @supercharge/map
Find all the details for @supercharge/map
in the extensive Supercharge docs.
Using @supercharge/map
is pretty straightforward. Import the Map
class exported from the @supercharge/map
package and use it (almost) the same way you would use JavaScript’s Map
class. This package gives you the parameter order key, value, map
in callbacks. JavaScript’s Map class gives you value, key, map
:
const Map = require('@supercharge/map')
const cache = new Map()
cache.isEmpty()
// true
cache
.set('user:1', 'Marcus')
.set('user:2', 'Supercharge')
cache.isNotEmpty()
// true
const users = cache.map((key, value, map) => {
return { [key]: value }
})
// [{ 'user:1': 'Marcus' }, { 'user:2': 'Supercharge' }]
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊
git checkout -b my-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © Supercharge
superchargejs.com · GitHub @supercharge · Twitter @superchargejs
FAQs
An extended Map class and the one JavaScript should have shipped
The npm package @supercharge/map receives a total of 1 weekly downloads. As such, @supercharge/map popularity was classified as not popular.
We found that @supercharge/map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.