schlechtenburg/packages/rich-text/lib/is-empty.ts
2024-10-08 09:15:26 +02:00

14 lines
360 B
TypeScript

import { RichTextValue } from "./types";
/**
* Check if a Rich Text value is Empty, meaning it contains no text or any
* objects (such as images).
*
* @param {RichTextValue} value Value to use.
*
* @return {boolean} True if the value is empty, false if not.
*/
export function isEmpty( { text }: RichTextValue ): boolean {
return text.length === 0;
}