word-counting
Version:
A very powerful words counter that supports plain text and html.
33 lines (32 loc) • 906 B
TypeScript
/**
* The config settings for the wordsCounter function
* @interface Config
*/
interface Config {
/**
* Set to true if you want to process html formated text and the counter
* won't count tags.
* @memberof Config
*/
isHtml?: boolean;
isUnique?: boolean;
}
/**
* The result that the wordsCounter function return.
* @interface Result
*/
interface Result {
/**
* The amount of the words in the passed text
* @memberof Result
*/
wordsCount: number;
}
/**
* The function that can count the words occurrence in text
* @param text The string that you want to count words
* @param config The config settings for the wordsCounter function
* @returns an object that has the words occurrence information
*/
declare const wordsCounter: (text: string, config?: Config | undefined) => Result;
export default wordsCounter;