@types/wordpress__wordcount
Version:
TypeScript definitions for @wordpress/wordcount
55 lines (47 loc) • 1.72 kB
Markdown
# Installation
> `npm install --save @types/wordpress__wordcount`
# Summary
This package contains type definitions for @wordpress/wordcount (https://github.com/WordPress/gutenberg/tree/master/packages/wordcount/README.md).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wordpress__wordcount.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wordpress__wordcount/index.d.ts)
````ts
export type CountType = "words" | "characters_excluding_spaces" | "characters_including_spaces";
export interface Settings {
HTMLEntityRegExp: RegExp;
HTMLRegExp: RegExp;
HTMLcommentRegExp: RegExp;
astralRegExp: RegExp;
characters_excluding_spacesRegExp: RegExp;
characters_including_spacesRegExp: RegExp;
connectorRegExp: RegExp;
l10n: {
type?: CountType | undefined;
/** Array of known shortcode names */
shortcodes?: string[] | undefined;
};
/** Characters to be removed from input text. */
removeRegExp: RegExp;
spaceRegExp: RegExp;
wordsRegExp: RegExp;
}
/**
* Count some words.
*
* @param text - The text being processed
* @param type - The type of count.
* @param [userSettings] - Custom settings object.
*
* @example
* ```js
* import { count } from '@wordpress/wordcount';
* const numberOfWords = count( 'Words to count', 'words' )
* ```
*/
export function count(text: string, type: CountType, userSettings?: Partial<Settings>): number;
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
* Dependencies: none
# Credits
These definitions were written by [Derek Sifford](https://github.com/dsifford).