Simple and powerful parser for advanced search queries like GitHub search queries.
import { QueryParser } from 'search-queries';
const parser = new QueryParser({ modifiers: ['!', '-'] });
const query = parser.parse(
`fancy words label:foo -label:bar and "multiple words string" -"excluded phrase"`
);
// Yield object equal to
expect(query).toEqual([
{ value: 'fancy' },
{ value: 'words' },
{ keyword: 'label', value: 'foo' },
{ keyword: 'label', value: 'bar', modifier: '-' },
{ value: 'and' },
{ value: 'multiple words string' },
{ value: 'excluded phrase', modifier: '-' },
]);
TODO: add docs
search-queries
is an truth open source project, so you are welcome on project github repository to contribute a code, make issues with feature requests and bug reports.
You may contribute to a project if you tell about search-queries
to your friends.