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

filter-observable-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-observable-store

Filter down an observable-store

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Filter-observable-store

Filter down an observable store https://github.com/flams/observable-store.

A filtered observable-store will:

  • Return a count of items that match the filter
  • Only loop over items that match the filter
  • Only trigger events on items that match the filter

Installation

npm install filter-observable-store

How to use

var Store = require("observable-store");
var Filter = require("filter-observable-store");

var store = new Store([5, 10, 15]);

// Create a new filter around an existing store
var filter = new Filter(store);


// Set a filter function
filter.setFilter(function (value) {
    return value >= 10;
}, scope);

// Get filtered count:
filter.count(); // 2

// Loop over filtered items
filter.loop(function (value) {
    // value... 10, 15...
});

// See if an item is in the filtered model
filter.has(5); // false
filter.has(10); // true

// Clear filter
filter.clearFilter();

Changelog

0.0.2 - 6 APR 2015

  • Add filtered has()

0.0.1 - 5 APR 2015

  • first release

License:

MIT

Keywords

FAQs

Package last updated on 07 Apr 2015

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