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

sift

Package Overview
Dependencies
Maintainers
2
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sift

MongoDB query filtering in JavaScript

  • 17.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9M
increased by3.13%
Maintainers
2
Weekly downloads
 
Created

What is sift?

The sift npm package is a library that provides a way to use MongoDB-like query syntax for filtering, sorting, and manipulating JavaScript arrays and objects. It is commonly used for client-side querying of JSON data, in-memory database emulation, and other applications where MongoDB query semantics are desired without a database.

What are sift's main functionalities?

Filtering Arrays

This code sample demonstrates how to filter an array of objects to find elements where the age is greater than 18 and the name starts with the letter 'J'.

{"$and":[{"age":{"$gt":18}},{"name":{"$regex":"^J"}}]}

Sorting Arrays

This code sample shows how to sort an array of objects by the age property in ascending order.

{"$sort":{"age":1}}

Projection

This code sample illustrates how to create a projection of an array of objects, including only the name and age properties in the output.

{"$project":{"name":1,"age":1}}

Other packages similar to sift

FAQs

Package last updated on 17 Apr 2024

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