crop-string
Version:
Trims strings to a maximum length and appends dot dot dot if needed.
16 lines • 524 B
TypeScript
/** @module crop-string
*/
declare module "crop-string" {
/**
* @function
* @param {string} string
* @param {number} [maxLength=16]
* @param {string} [endString="…"]
* @returns {string} A string that with a length that equals to or is smaller than maxLength
* @example
* import cropString from "crop-string"
* const result = cropString("hello", 4)
* result === "hel…"
*/
export default function(string: string, maxLength?: number, endString?: string): string;
}