ranuts 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ import { detect as i } from "jschardet";
2
+ var a = (n) => {
3
+ const r = Array.from(n).map((e) => String.fromCharCode(e)).join("");
4
+ return i(r).encoding || "utf-8";
5
+ }, g = (n) => {
6
+ const r = n instanceof Uint8Array ? n : new Uint8Array(n);
7
+ return new TextDecoder(a(r)).decode(r);
8
+ }, s = (n) => {
9
+ if (n instanceof ArrayBuffer) {
10
+ const r = new Uint8Array(n), e = String.fromCharCode.apply(null, r), t = i(e), c = t.encoding || "utf-8", o = new TextDecoder(c).decode(n);
11
+ if (t.encoding && o) return {
12
+ encoding: t.encoding,
13
+ content: o
14
+ };
15
+ }
16
+ };
17
+ export {
18
+ g as arrayBufferToString,
19
+ a as checkEncoding,
20
+ s as transformText
21
+ };
@@ -2,10 +2,12 @@ import { createBottomFollower } from "./scroll.js";
2
2
  import { diffLines } from "./diff.js";
3
3
  import { SyncHook } from "./subscribe.js";
4
4
  import { Mathjs, addNumSym, formatBytes, clamp, fit, inverseLerp, lerp, linearstep, mathjs, parseChineseNumber, parseEnglishNumber, parseRomanNumber, perToNum, range, remap, smoothstep, transformNumber } from "./number.js";
5
- import { MessageCodec, arrayBufferToString, checkEncoding, clearBr, clearStr, getMatchingSentences, getRandomString, isString, randomString, strParse, toFullWidth, toHalfWidth, toString, transformText, truncate, truncateWithMarker, fenceCode, slugify, csvEscape } from "./str.js";
5
+ import { MessageCodec, clearBr, clearStr, getMatchingSentences, getRandomString, isString, randomString, strParse, toFullWidth, toHalfWidth, toString, truncate, truncateWithMarker, fenceCode, slugify, csvEscape } from "./str.js";
6
6
  import type { BottomFollower, BottomFollowerOptions } from "./scroll.js";
7
7
  import type { DiffHunk, DiffLine, DiffLineKind, DiffOptions } from "./diff.js";
8
- import type { TransformText, TruncateOptions, TruncatePosition } from "./str.js";
8
+ import type { TruncateOptions, TruncatePosition } from "./str.js";
9
+ import { arrayBufferToString, checkEncoding, transformText } from "./charset.js";
10
+ import type { TransformText } from "./charset.js";
9
11
  import { createSpeechRecognizer, isSpeechRecognitionSupported } from "./speech.js";
10
12
  import type { SpeechError, SpeechErrorKind, SpeechRecognizer, SpeechRecognizerOptions } from "./speech.js";
11
13
  import { appendUrl, connection, createObjectURL, durationHandler, encodeUrl, getAllQueryString, getCookie, getCookieByName, getFrame, getPixelRatio, getWindow, imageRequest, isInIframe, isSafari, networkSpeed, queryFlag, requestUrlToBuffer } from "./bom.js";