1.0.1 • Published 5 years ago

hide-some-words v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

hide-some-words

npm version travis PRs Welcome code style: prettier License: MIT

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

NameTypeDefaultDescription
textstringThe input text
percentagenumber0.3A percentage between 0.0 to 1.0 which determines the amount of (hideable) words to hide
characterstring_The replacement character
skipLengthnumber2The length that a word needs to have in order to skip it

License

MIT

1.0.1

5 years ago

1.0.0

5 years ago