
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
npm install pmap
A path map has the same API surface as an ES6 Map
, except keys are arrays (or iterables) describing paths.
Internally, a trie data structure is used to store entries.
Here are some examples.
import PathMap from 'pmap';
const map = new PathMap();
map.set(['a','b','c'], 2);
// . (empty)
// └--a (empty)
// └--b (empty)
// └--c (2)
console.log(map.has(['a','b','c'])); // true
console.log(map.has(['a','b'])); // false
console.log(map.get(['a','b','c'])); // 2
map.set('ax', 3); // any iterable can be a path
// identical to map.set(['a', 'x'], 3)
// . (empty)
// └--a (empty)
// |--b (empty)
// | └--c (2)
// └--x (3)
map.set(['a'], 9);
// . (empty)
// └--a (9)
// |--b (empty)
// | └--c (2)
// └--x (3)
map.set([], null);
// . (null)
// └--a (9)
// |--b (empty)
// | └--c (2)
// └--x (3)
map.delete('abc');
// . (null)
// └--a (9)
// └--x (3)
// there's also a find() method
// which ES6 `Map` doesn't have
map.clear();
map.set('my dog');
map.set('my dog has fleas');
map.set('my doug');
map.set('my doge');
map.set('my cat');
for (const [path] of map.find('my dog')) {
console.log(path.join(''));
}
// 'my dog'
// 'my dog has fleas'
// 'my doge'
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
Caveats, change logs and notes:
FAQs
Trie-based ES6 Map clone: keys=iterables, values=anything
The npm package pmap receives a total of 83 weekly downloads. As such, pmap popularity was classified as not popular.
We found that pmap 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.