search-terms

1.0.2 • Public • Published

Actions Status

search-terms

Get search terms separated by spaces from a search query. Negative terms have a dash(-) in front. Terms can have spaces or a dash at the beginning if quoted.

Example

const searchTerms = require("search-terms");

//  positive terms ---------⏷--------⏷------------------⏷
console.log(searchTerms("this-is 'a string' -'-with' '-positive' -'and negative' -terms"));
//  negative terms -----------------------------⏶-----------------------⏶---------⏶

/*
 * Result:
 *
 * {
 *   "positive":  [
 *     "this-is",
 *     "a string",
 *     "-positive",
 *   ],
 *   "negative":  [
 *     "-with",
 *     "and negative",
 *     "terms"
 *   ]
 * }
 */

/search-terms/

    Package Sidebar

    Install

    npm i search-terms

    Weekly Downloads

    3

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • tonybrix