sanitizePastedTextfunction
The text as it will be read: control and invisible characters (and line and paragraph separators) turned into
spaces, then cut to EXTRACT_LIMITS.characters.
Import it
import { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";
Also exported from: @johnmorrisdotca/hikidashi
Definition
function sanitizePastedText(raw: string): { text: string; truncated: boolean; }
Parameters
| Name | Type | Description |
|---|---|---|
raw | string | The pasted text, of any length. |
Returns
{ text: string; truncated: boolean; }
The cleaned text, and whether it was cut.
Examples
import { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";
console.log(sanitizePastedText("水\u0000を\u200b飲む"));{ text: '水 を 飲む', truncated: false }What it prints (run when this page was built)