New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hart/modmap

Package Overview
Dependencies
Maintainers
7
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hart/modmap - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

package.json
{
"name": "@hart/modmap",
"version": "0.1.2",
"version": "0.1.3",
"description": "modmap: easy access key/value store with tags",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -7,11 +7,109 @@ # modmap

Describe modmap here.
[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
[build]: https://travis-ci.org/user/repo
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.org/package/npm-package
[npm-badge]: https://img.shields.io/npm/v/@hart/modmap.svg?style=flat-square
[npm]: https://www.npmjs.com/package/@hart/modmap
[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
[coveralls]: https://coveralls.io/github/user/repo
# Install
```
npm install @hart/modmap
```
# Usage
## exported functions
```
import { set, get, all, byTag, getTags, unset, clear } from '@hart/modmap';
//default import is 'get'
import get from '@hart/modmap';
```
## set - Set value with a key
```
const value = { ... };
set('key', value);
```
## set - Set value with a key and tag(s)
```
const value = { ... };
set('key', value, 'tag1', 'tag2', 'tag3');
```
## get - Get value by key
```
set('key1', { ... });
const value = get('key'); // { ... }
const noValue = get('badKey'); // null
```
## all - Get all key/values
```
set('key1', { ... });
set('key2', { ... });
const allKeyValues = all(); // { key1: {}, key2: {} }
```
## byTag - Get key/values by tag
```
set('key1', { ... }, 'tag1');
set('key2', { ... }, 'tag1', 'tag2');
const tag1Values = byTag('tag1'); // { key1: {}, key2: {} }
const tag2Values = byTag('tag2'); // { key2: {} }
const tag3Values = byTag('tag3'); // { }
```
## getTags - Get all tags
```
set('key1', { ... }, 'tag1');
set('key2', { ... }, 'tag1', 'tag2');
const tags = getTags(); // [ "tag1", "tag2" ]
```
## unset - Remove a key/value
```
set('key1', { ... }, 'tag1');
set('key2', { ... }, 'tag1');
unset('key1');
const value = get('key1'); // null
const valuesByTag = byTag('tag1'); // { key2: {} }
```
## clear - Remove all key/values and clears all tags
```
set('key1', { ... }, 'tag1');
set('key2', { ... }, 'tag1', 'tag2');
clear();
const value = get('key1'); // null
const allKeyValues = all(); // { }
const allTags = getTags(); // [ ]
```
## Author
- [Mark Zepeda](https://github.com/markario)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc