gmail-string-query
v0.0.10
Published
Simulate GMail search queries using Lucene Filters
Downloads
4
Maintainers
Readme
gmail-string-query
Simulate GMail search queries using Lucene Filters
Fork of finwo/lucene-filter.
Changes:
- implicit operator is AND not OR
- support for
label:name
queries - depends on
lucene-query-parse
only
Installation
npm i -s gmail-string-query
yarn add gmail-string-query
Example
import * as query from "gmail-string-query";
const data = [
{
id: 1,
to: "[email protected]",
from: "[email protected]",
// labels have to be a string separated by commas under the `label` key
label: "foo,bar,!s-baz"
},
{
id: 2,
to: "[email protected]",
from: "[email protected]",
label: "foo"
},
{
id: 3,
to: "[email protected]",
from: "[email protected]",
label: "!s-baz"
}
];
const result = data.filter(
query("to:[email protected] OR (label:!s-baz label:foo)")
);
console.log(result.map(r => r.id)); // -> [1, 3]
Why?
Part of GMail API mock used in taskbot