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

localcollection

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localcollection

MongoDB Query Style Array Filtering and Modifying

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

localCollection

A Sift.JS wrapper that adds array modification and MongoDB collection-like instantiation for easy access to collections.

MongoDB inspired array filtering

For extended documentation, checkout MongoDB's Docs and Sift.JS

Installation


npm install localcollection --save

var localCollection = require('localcollection');

var Collection = new localCollection( YOUR_ARRAY/OBJECT );

Node.js Examples


var localCollection = require('localcollection');

var someArray = [{id: 1}, {id:2}, {id:3}];

var SomeArray = new localCollection(someArray);

// Find
SomeArray.find({id:2});
// [ {id:2} ]

// FindOne
SomeArray.findOne({id:2});
// {id:2}

// Remove
SomeArray.remove({id:2});
// [ {id:1}, {id:3} ]

// Count
SomeArray.find({id:3}).count()
// 1

// Update
SomeArray.update({id:3}, function(ob){ob.magic = true});
// [ {id:1}, {id:3, magic:true} ]

// Insert
SomeArray.insert({yoman: 'guild'});
// [ {id:1}, {id:3, magic:true}, {yoman: 'guild'} ]

// FindAndModify
SomeArray.findAndModify({yoman:'guild'}, function(ob){ob.happiness = true});
// [ {yoman:'guild', happiness:true} ]

Sift Dependency

This package is a simple wrapper on Sift.js. For more information on functionality and features, see Sift.js

Keywords

FAQs

Package last updated on 30 Jan 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