1.0.2 • Published 4 years ago
droptheword v1.0.2
DropTheWord
Install
npm install droptheword
Demo
https://pedantic-benz-27df81.netlify.com/
Usage
import { replaceSpacesInString, replaceSpacesInCssSelector } from "droptheword";
Usage with strings
Function will transform provided string to string with "hard spaces" after each word provided in an array.
const myOldString =
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
const wordsToDrop = ["is", "of", "and", "the"];
const myNewString = replaceScacesInString({
text: myOldString,
dropWordList: wordsToDrop
});
Usage with CSS selector
Function will search the page for css selector occurrences and it will transform text content of it to string with hard spaces.
const myCssSelector = "[data-text=my-paragraphs]";
const wordsToDrop = ["is", "of", "and", "the", "no"];
replaceSpacesInCssSelector({
cssSelector: myCssSelector,
dropWordList: wordsToDrop
});