recipe-search-parser
v1.1.8
Published
An algorithms for transforming natural language search into categories.
Downloads
19
Maintainers
Readme
Installation
npm install recipe-search-parser
yarn add recipe-search-parser
Usage
import SearchParser from "recipe-search-parser";
const searchParser = new SearchParser();
Stringify
const query = "cake with chocolate"
const category = "sweet"
const include = ["sugar", "flour"]
const exclude = ["salt"]
searchParser.stringify({
query,
category,
include,
exclude
})
// Return: cake-with-cholocate-categoria-sweet-con-sugar-flour-senza-salt
Parse
const URL = "cake-with-cholocate-categoria-sweet-con-sugar-flour-senza-salt"
searchParser.parse(URL)
// Return: {
// query: "cake with chocolate",
// category: "sweet",
// include: ["sugar", "flour"],
// exclude: ["salt"]
Contribute
You are welcome to contribute!