is-string-ascii-es/README.md
2026-07-02 17:38:31 +08:00

2.4 KiB

Is String ASCII (ES)

⚖️ MIT

🔗 DistBoard @hugoalh ● GitHub ● JSR ● NPM

An ECMAScript module to determine whether the string is ASCII.

🎯 Runtime Targets

Any runtime which support ECMAScript should able to use this; These runtimes are officially supported:

🛡️ Runtime Permissions

This does not request any runtime permission.

#️⃣ Sources & Entrypoints

  • GitHub Raw
    https://raw.githubusercontent.com/hugoalh/is-string-ascii-es/{Tag}/mod.ts
    
  • JSR
    jsr:@hugoalh/is-string-ascii[@{Tag}]
    
  • NPM
    npm:@hugoalh/is-string-ascii[@{Tag}]
    
Name Path Description
. ./mod.ts Default.
./all ./all.ts All ASCII characters.
./control ./control.ts ASCII control characters.
./printable ./printable.ts ASCII printable characters.

Note

  • Different runtimes have vary support for the sources and entrypoints, visit the runtime documentation for more information.
  • It is recommended to include tag for immutability.
  • These are not part of the public APIs hence should not be used:
    • Benchmark/Test file (e.g.: example.bench.ts, example.test.ts).
    • Entrypoint name or path include any underscore prefix (e.g.: _example.ts, foo/_example.ts).
    • Identifier/Namespace/Symbol include any underscore prefix (e.g.: _example, Foo._example).

🧩 APIs

  • function isStringASCII(item: string): boolean;
    
  • function isStringASCIIControl(item: string): boolean;
    
  • function isStringASCIIPrintable(item: string): boolean;
    

Note

✍️ Examples

  • isStringASCII("日本語");
    //=> false
    
  • isStringASCII("👀");
    //=> false
    
  • isStringASCII("Hello, world!");
    //=> true
    
  • isStringASCII("");
    //=> true