The library to scrape and manage snippets from some text.
Install
npm i textvarify
How to use
import{Snippet}from"textvarify/lib/snippet";import{SnippetBorder}from"textvarify/lib/models/borders";consttext='Hello, {{user}}, i am a demo case.';snippet=newSnippet(SnippetBorder.BRACE,2);// init snippet as {{snippet}}scraper=newScraper(snippet);// init scraperconstvalues=scraper.getAllValues(text);// values = ['user'];constborderValues=scraper.getAllValuesWithBorder(text);// borderValues = ['{{user}}'];constmaching=scraper.isMatch(text);// maching = true; there is at least one snippet in the text.