-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add text setters * fix: add text manipulators
- Loading branch information
Showing
4 changed files
with
136 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,8 @@ $ yarn add advanced-search-query | |
import parseAdvancedSearchQuery from 'advanced-search-query' | ||
|
||
// Perform parsing | ||
const str = 'to:me -from:[email protected] foobar1 -foobar2' | ||
const parsedSearchQuery = parseAdvancedSearchQuery(str) | ||
const input = 'to:me -from:[email protected] foobar1 -foobar2' | ||
const parsedSearchQuery = parseAdvancedSearchQuery(input) | ||
|
||
// [ { text: 'foorbar1', isNegated: false }, { text: 'foobar2', isNegated: true } ] | ||
parsedSearchQuery.getTexts() | ||
|
@@ -46,12 +46,16 @@ parsedSearchQuery.toString() | |
parsedSearchQuery.removeKeyword('from', true).toString() | ||
|
||
// `to:me from:[email protected] foobar1 -foobar2` | ||
parsedSearchQuery.addEntry('from', '[email protected]', false).toString() | ||
parsedSearchQuery.addKeyword('from', '[email protected]', false).toString() | ||
|
||
// `from:[email protected] foobar1 -foobar2` | ||
parsedSearchQuery.removeEntry('to', 'me', false).toString() | ||
parsedSearchQuery.removeKeyword('to', 'me', false).toString() | ||
|
||
/* clone operation instantiates a new version by copying over data. */ | ||
// `from:[email protected] -foobar2` | ||
parsedSearchQuery.removeText('foobar1').toString() | ||
|
||
// `from:[email protected] foobar1 -foobar2` | ||
parsedSearchQuery.addText('foobar1', false).toString() | ||
|
||
// `from:[email protected] foobar1 -foobar2` | ||
parsedSearchQuery.clone().toString() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "commonjs", | ||
"strict": true, | ||
"outDir": "dist/node/", | ||
"sourceMap": true, | ||
"declaration": true, | ||
"types": ["jest"], | ||
"skipLibCheck": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"./src/**/*", | ||
"./tests/**/*", | ||
"./node_modules/@types/**/*" | ||
] | ||
} | ||
{ | ||
"compilerOptions": { | ||
"lib": ["es2019"], | ||
"target": "es6", | ||
"module": "commonjs", | ||
"strict": true, | ||
"outDir": "dist/node/", | ||
"sourceMap": true, | ||
"declaration": true, | ||
"types": ["jest"], | ||
"skipLibCheck": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"./src/**/*", | ||
"./tests/**/*", | ||
"./node_modules/@types/**/*" | ||
] | ||
} |