GithubHelp home page GithubHelp logo

afrog33k / loopback-filters Goto Github PK

View Code? Open in Web Editor NEW

This project forked from strongloop/loopback-filters

0.0 3.0 0.0 35 KB

implements LoopBack-style filtering.

Home Page: http://loopback.io

License: Other

JavaScript 100.00%

loopback-filters's Introduction

loopback-filters

This module implements LoopBack style filtering without any dependencies on LoopBack.

Install

$ npm install loopback-filters

Usage

Below is a basic example using the module

var applyFilter = require('loopback-filters');
var data = [{foo: 'bar'}, {bat: 'baz'}, {foo: 'bar'}];
var filter = {where: {foo: 'bar'}};

var filtered = applyFilter(data, filter);

console.log(filtered);

The output would be:

[{foo: 'bar'}, {foo: 'bar'}]

Features

Where

// return items where
applyFilter({
  where: {
    // the price > 10 && price < 100
    price: {gt: 10, lt: 100},

    // match Mens Shoes and Womens Shoes and any other type of Shoe
    category: {like: '.* Shoes'},

    // the status is either in-stock or available
    status: {inq: ['in-stock', 'available']}
  }
})

Only include objects that match the specified where clause. See full list of supported operators.

Geo Filter / Near

applyFilter(data, {
  where: {
    location: {near: '153.536,-28'}
  },
  limit: 10
})

Sort objects by distance to a specified GeoPoint.

Order

Sort objects by one or more properties.

Limit / Skip

Limit the results to a specified number. Skip a specified number of results.

Fields

Include or exclude a set of fields in the result.

Note: Inclusion from loopback is not supported!

Docs

See the LoopBack docs for the filter syntax.

loopback-filters's People

Contributors

ritch avatar amir-61 avatar rmg avatar sam-github avatar

Watchers

Ronald Adonyo avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.