Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wildcard-store

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wildcard-store

A JavaScript store that supports wildcards in keys and finds. The best choice for event emitters

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

wildcard-store

A JavaScript store with glob-like patterns best suitable for event emitters. Supports one- and two-star wildcards both in keys and when finding records.

Installation

npm install --save wildcard-store

API

set(key, value, [uses])

Saves the value to the internal storage. The third parameter limits the number of times the value can be retrieved.

get(pattern)

Returns an array of values whose kes matches the provided pattern.

del(key, [value])

Removes values whose key exactly matches the provided one. If a value is provided, deletes only records that are equal to it.

Usage

let Store = require('wildcard-store');

// Settings are optional
let store = new Store({
  delimeter: '.', // namespace delimiter
  prefix: '~' // key prefix for the internal storage
});


store.set('app.user.created', 'foo');
store.set('app.model.created', 'bar', 1);

store.get('app.user.created') // ['foo']
store.get('app.**'); // ['foo', 'bar'] because ** matches any number of namespaces
store.get('app.*'); // [] because * matches strictly one level of namespaces
store.get('orm.model.created'); // [] because 'bar' has already depleted its limit

Keywords

FAQs

Package last updated on 26 Nov 2016

Did you know?

Socket

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.

Install

Related posts

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