0.0.8 • Published 1 year ago

@singulargarden/gmail-filter-query-parser v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Gmail Filter Query Parser

Forked from github.com/zorji/gmail-filter-query-parser

A nearley based parser to parse/serialise Gmail filter query.

Installation

npm install gmail-filter-query-parser

Usage

import { parse, serialise, HasAttachment, Subject } from 'gmail-filter-query-parser'

const parsed = parse('subject:(invoice) AND has:attachment')
console.log(parsed)
// {
//   "$and": [
//     {
//       "type": "subject",
//       "value": "invoice"
//     },
//     {
//       "type": "has:attachment"
//     }
//   ]
// }

const serialised = serialise(AND(
  Subject('invoice'),
  HasAttachment(),
))
console.log(serialised)
// 'subject:(invoice) AND has:attachment'

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago