disarm 0.16.0 → 0.17.1

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.
package/README.md CHANGED
@@ -10,7 +10,7 @@ prebuilt native addons install with no Rust toolchain.
10
10
  npm install disarm
11
11
  ```
12
12
 
13
- Ships TypeScript types (`.d.ts`) — no `@types/disarm` needed. Requires Node 14+.
13
+ Ships TypeScript types (`.d.ts`) — no `@types/disarm` needed. Requires Node 22+.
14
14
 
15
15
  ## Quick start
16
16
 
package/binding.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
3
12
  /**
4
13
  * A reusable, opaque lexicon handle (HAI-SDLC 6.1).
5
14
  *
@@ -131,7 +140,10 @@ export interface ConfusableCoverage {
131
140
 
132
141
  export declare function confusablesVersion(): string
133
142
 
134
- /** Replace emoji with their plain names; `strip_modifiers` drops skin-tone marks. */
143
+ /**
144
+ * Replace emoji with their plain names; `strip_modifiers` drops skin-tone marks. An
145
+ * emoji CLDR cannot name becomes `[?]`, as in every binding.
146
+ */
135
147
  export declare function demojize(text: string, stripModifiers: boolean): string
136
148
 
137
149
  /**
@@ -315,7 +327,11 @@ export declare function isNormalized(text: string, form: string): boolean
315
327
  */
316
328
  export declare function isSuspiciousHostname(host: string): boolean
317
329
 
318
- export declare function isZalgo(text: string, threshold: number): boolean
330
+ /**
331
+ * Whether any base carries more than `threshold` marks; omitted, the core's default
332
+ * (`api::DEFAULT_ZALGO_THRESHOLD`, 3).
333
+ */
334
+ export declare function isZalgo(text: string, threshold?: number | undefined | null): boolean
319
335
 
320
336
  /** One group of distinct inputs that reduce to the same key (#620). */
321
337
  export interface KeyCollision {
@@ -363,8 +379,9 @@ export declare function listContextLangs(): Array<string>
363
379
  export declare function listScripts(): Array<string>
364
380
 
365
381
  /**
366
- * ML/NLP normalization: NFKC → emoji→text → transliterate → strip accents →
367
- * [case fold] → strip control → strip zero-width → collapse whitespace.
382
+ * ML/NLP normalization: resolve deletions → NFKC → emoji→text → transliterate →
383
+ * strip accents → emoji→text → [case fold] → strip control → strip zero-width →
384
+ * collapse whitespace → NFC.
368
385
  *
369
386
  * `fold_case` defaults to `true`. Pass `false` in front of a CASED model: the fold is
370
387
  * destructive, cannot be undone downstream, and an uncased evaluation harness cannot
@@ -410,8 +427,12 @@ export declare function reverseTransliterate(text: string, lang: string): string
410
427
  * A safe **filename**, not a safe URL path segment. `%` is legal in a filename, so one
411
428
  * the caller typed is kept — `sanitizeFilename("..%2Fetc")` returns `"%2Fetc"` — and a
412
429
  * consumer that percent-decodes the result must validate *after* decoding. What this
413
- * will not do is manufacture one: `%` never appears in the output unless it appeared in
414
- * the input (#721).
430
+ * will not do is manufacture one: every `%` in the output is one the input contained, or
431
+ * part of the separator (#721).
432
+ *
433
+ * `separator` must be printable, non-space ASCII with no character illegal on
434
+ * `platform` and no path separator (`/`, `\`); anything else throws
435
+ * `DisarmInvalidArgument`. `""` is allowed, and so is `" "` on its own.
415
436
  */
416
437
  export declare function sanitizeFilename(text: string, separator: string, maxLength: number, platform: string, lang: string | undefined | null, preserveExtension: boolean): string
417
438
 
@@ -494,7 +515,11 @@ export declare function stripTags(text: string): string
494
515
  /** Strip every variation selector (VS1–VS256) (#413). */
495
516
  export declare function stripVariationSelectors(text: string): string
496
517
 
497
- export declare function stripZalgo(text: string, maxMarks: number): string
518
+ /**
519
+ * Cap combining marks per base at `max_marks`; omitted, the core's default
520
+ * (`api::DEFAULT_ZALGO_MAX_MARKS`, 3), so this binding never restates it (B1).
521
+ */
522
+ export declare function stripZalgo(text: string, maxMarks?: number | undefined | null): string
498
523
 
499
524
  export declare function stripZeroWidthChars(text: string): string
500
525
 
@@ -505,7 +530,8 @@ export declare function transliterate(text: string): string
505
530
 
506
531
  /**
507
532
  * Transliterate with a scheme (`"default"` | `"strict_iso9"` | `"gost7034"`)
508
- * and/or a language profile (`lang`), via the core's builder.
533
+ * and/or a language profile (`lang`), via the core's builder. An unknown `lang`
534
+ * throws `DisarmInvalidArgument`, as the key builders' always has.
509
535
  */
510
536
  export declare function transliterateOpts(text: string, scheme: string, lang?: string | undefined | null): string
511
537