@types/wordpress__wordcount
TypeScript icon, indicating that this package has built-in type declarations

2.4.5 • Public • Published

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

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/wordpress__wordcount

Weekly Downloads

11,537

Version

2.4.5

License

MIT

Unpacked Size

4.74 kB

Total Files

5

Last publish

Collaborators

  • types