2.4.5 • Published 6 months ago
@types/wordpress__wordcount v2.4.5
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
// Type definitions for @wordpress/wordcount 2.4
// Project: https://github.com/WordPress/gutenberg/tree/master/packages/wordcount/README.md
// Definitions by: Derek Sifford <https://github.com/dsifford>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5
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: Fri, 02 Jul 2021 18:05:56 GMT
- Dependencies: none
- Global values: none
Credits
These definitions were written by Derek Sifford.