hide-some-words
v1.0.1
Published
Hides some words from a blob of text
Downloads
3
Readme
hide-some-words
Hides some words from a blob of text. For input foo bar test example
it may return foo bar ___ example
.
Usage
const hideSomeWords = require("hide-some-words");
const text =
`Lorem ipsum dolor sit amet, consectetur adipiscing elit.Proin eget erat urna.
Donec vel dui vel felis efficitur posuere vitae nec massa. Nullam auctor
porttitor ligula, eget consequat sem hendrerit ac. Nam tristique aliquet sapien,
vel tincidunt urna mattis porttitor. Quisque ullamcorper eu lectus vitae luctus.`;
console.log(hideSomeWords(text));
consistently prints:
_____ ipsum dolor ___ amet, ___________ adipiscing ____.Proin ____ ____ urna.
Donec ___ dui vel felis efficitur posuere _____ nec _____. Nullam ______
_________ ______, eget consequat ___ _________ ac. ___ tristique _______ sapien,
vel _________ urna mattis porttitor. _______ ullamcorper eu lectus vitae luctus.
Parameters
|Name|Type|Default|Description| |---|---|---|---| |text|string| |The input text| |percentage|number|0.3|A percentage between 0.0 to 1.0 which determines the amount of (hideable) words to hide| |character|string|_|The replacement character| |skipLength|number|2|The length that a word needs to have in order to skip it|