sanitizePastedText関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";
ほかのエクスポート元: @johnmorrisdotca/hikidashi
定義
function sanitizePastedText(raw: string): { text: string; truncated: boolean; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
raw | string | The pasted text, of any length. |
戻り値
{ text: string; truncated: boolean; }
The cleaned text, and whether it was cut.
例
import { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";
console.log(sanitizePastedText("水\u0000を\u200b飲む"));{ text: '水 を 飲む', truncated: false }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。