search_by_tags

0.1.0 • Public • Published

Search by tag/s (search_by_tags)

How to use

const { searchByTags } = require('search_by_tags');
// Parse your query url to this => ['eq:a|b', 'eq:c', 'not:d']
// Meaning:
// - tag must contain `c`
// - tag must contains `a` or `b`
// - tag must NOT contains `d`
const res = searchByTags(['eq:a|b', 'eq:c', 'not:d']);
// req.eqAnd = ['c']
// req.eqOr = ['a', 'b']
// req.notEqAnd = ['d']

Example

  • From input url like https://api.example.com?tags=eq:a&tags=eq:b|c&tags=not:d
  • To output:
{
  eqAnd: ['a'],
  eqOr: ['b','c'],
  notEqAnd: ['d']
}

Tests

  • npm test

Package Sidebar

Install

npm i search_by_tags

Weekly Downloads

157

Version

0.1.0

License

ISC

Unpacked Size

5.72 kB

Total Files

7

Last publish

Collaborators

  • doron2402