Socket
Socket
Sign inDemoInstall

@florajs/request-parser

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@florajs/request-parser

Request parser for Flora


Version published
Weekly downloads
1
decreased by-80%
Maintainers
0
Weekly downloads
 
Created
Source

@florajs/request-parser

NPM version NPM downloads

Parse Flora requests into the internal object format.

Usage

const { parse } = require('@florajs/request-parser');

parse({
    id: 42,
    limit: 100,
    page: 10,
    order: 'lastname:asc',
    search: 'foo',
    select: 'id,firstname,lastname,address[street,zip]',
    filter: 'address.zip=1234',
});

Order syntax

lastname:asc
lastname:desc
firstname:asc,lastname:desc
:random

Select syntax

Simple attributes:

firstname,lastname

Children attributes:

firstname,lastname,address.street,address.zip
firstname,lastname,address[street,zip]

Additional parameters for children:

address(filter=active=true AND zip>10000)[street,zip]
subscriptions(filter=active=true)(order=createdAt:desc)[id,name,product.id]

Filter syntax

Filter by single attribute:

type.id=1

Filter by multiple values (OR):

type.id=1,2,3

Filter by multiple attributes (AND):

type.id=1 AND categories.id=2

Filter by multiple attributes (OR):

type.id=1 OR categories.id=2

Complex examples with parenthesis:

(type.id=1,2,3 OR countries.id=3,23) AND categories.id=2,65'

Ranges (10 <= foo <= 20):

foo=10..20

License

MIT

Keywords

FAQs

Package last updated on 13 Aug 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