0.0.7 • Published 5 months ago
text-trunc v0.0.7
Long text shortener
Installation
Use the following commands to install
# NPM
npm i txt-trunc
# YARN
yarn add txt-trunc
Usage
const textTrunc = require("text-trunc");
// OR
import textTrunc from "text-trunc";
const text = "your text";
// arguments [text, length, options?]
let truncate = textTrunc(text, 5, {});
Parameter
text: The text to be shortened
length: The number of words that are shortened and its default value is 10
options: ⬇⬇⬇⬇⬇⬇⬇
Options
options.start
The default value of this option is equal to 0 and it determines that the text to be shortened starts from the second character.
options.dots
This option determines what character or characters should be placed at the end of the shortened text The default value of this option is equal to "..." which can be set as desired
options.seperator
In this option, any value you put will be placed instead of the space between the words