API / @aionbuilders/nabu/format

countWords

Function Stability: stable

Number of words in a text (the default WordCounter of Nabu).

Signature

TypeScript
import { countWords } from '@aionbuilders/nabu/format';
TypeScript
function countWords(text: string, lang?: string): number

Parameters

Parameters of countWords
ParameterTypeDescription
textstringn/a
langoptionalstring

BCP 47 tag of the text (the editor's lang); unset: the platform default

Returns

number

Source: src/lib/utils/words.js:77