npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

boosterfilters

v1.0.0

Published

Sequalize filter DSL

Downloads

3

Readme

BoostFilters

BoostFilters is a JavaScript package that generates Sequelize filters from a provided dictionary. It supports a wide range of filter types, including full-text search, greater than, less than, equals, and more.

Installation

Install BoostFilters via npm:

npm install boostfilters

or via yarn:

yarn add boostfilters

Usage

First, import the generateFilterConditions function from the boostfilters package:

import { generateFilterConditions } from "boostfilters";

you can use it to build Sequelize queries:

const filters = {
  "name.fulltext": "John Doe",
  "age.greaterThan": 30,
  "createdAt.range": ["2022-01-01", "2023-01-01"],
};

const sequelizeFilters = generateFilterConditions(filters);

// Use `sequelizeFilters` in your Sequelize queries

In this example, sequelizeFilters will be an object suitable for use in a Sequelize where clause.

Query Types The generateFilterConditions function supports a variety of query types:

The keys of the query object should be the name of the field you want to query on, followed by a period and the type of the query. Here's a brief overview of each type:

  • fieldName.fulltext: Performs a "LIKE" search on fieldName. Matches any records where fieldName contains the provided value.

  • fieldName.equals: Matches any records where fieldName is exactly equal to the provided value.

  • fieldName.greaterThan: Matches any records where fieldName is greater than the provided value.

  • fieldName.lessThan: Matches any records where fieldName is less than the provided value.

  • fieldName.range: Matches any records where fieldName is within the provided range. The value for this query type should be an array with two elements: the start of the range and the end of the range.

  • fieldName.between: Matches any records where fieldName is between the two provided values.

  • fieldName.lessThanOrEqual: Matches any records where fieldName is less than or equal to the provided value.

fieldName.greaterThanOrEqual: Matches any records where fieldName is greater than or equal to the provided value.

You can also query associated tables by using the name of the associated table as a prefix to the field name, separated by a period. For example, to query the name field on an associated users table entries, you would use the key users.name.fulltext.