npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nounicode

v1.0.4

Published

A Utility to validate and enforce ASCII-only strings (modern, extended, or standard ASCII) in JavaScript/TypeScript.

Readme

nounicode

A JavaScript/TypeScript utility to detect and enforce ASCII-only text. Choose between modern (0–255), extended (128–255), or standard (0–127) ASCII checks.


Installation

npm install nounicode

Usage

Import the default function or named helpers:

import isNoUnicode, {
  isModernASCII,
  isExtendedASCII,
  isStandardASCII,
  ASCIIType
} from 'nounicode';

API Reference

isNoUnicode(data: string, type: ASCIIType = 'MODERN'): boolean

Validate that every character in a string falls within one of three ASCII ranges.

Parameters

  • data
    The input string to validate.

  • type
    One of the following modes (defaults to MODERN):

    • MODERN Checks code points < 256
    • EXTENDED Checks code points > 127 and < 256
    • STANDARD Checks code points < 128

Returns

  • true if all characters satisfy the chosen ASCII range.
  • false as soon as a character falls outside the specified range.

Notes

  • Uses String.prototype.codePointAt to handle all Unicode code points.
  • Iterates through code units, so astral characters (code points > 0xFFFF) are split into two iterations.

Examples

isNoUnicode('Hello, World!');            // true (all < 256)
isNoUnicode('Résumé', 'STANDARD');       // false ('é' is 233)
isNoUnicode('Résumé', 'EXTENDED');       // true  (233 > 127 && 233 < 256)
isNoUnicode('😊', 'MODERN');             // false (128522 ≥ 256)

isModernASCII(cc: number): boolean

Check if a Unicode code point is within 0–255.

Parameters

  • cc
    A Unicode code point (e.g., returned by str.codePointAt(idx)).

Returns

  • true if 0 ≤ cc < 256
  • false otherwise

Example

isModernASCII(200);  // true
isModernASCII(300);  // false

isExtendedASCII(cc: number): boolean

Check if a Unicode code point is within the extended ASCII range 128–255.

Parameters

  • cc
    A Unicode code point to test.

Returns

  • true if 128 < cc < 256
  • false otherwise

Example

isExtendedASCII(129);  // true
isExtendedASCII(127);  // false

isStandardASCII(cc: number): boolean

Check if a Unicode code point is within the standard ASCII range 0–127.

Parameters

  • cc
    A Unicode code point to test.

Returns

  • true if 0 ≤ cc < 128
  • false otherwise

Example

isStandardASCII(65);   // true ('A')
isStandardASCII(128);  // false

Types

export type ASCIIType = 'MODERN' | 'EXTENDED' | 'STANDARD';
  • MODERN All byte values (0–255)
  • EXTENDED Upper half of byte range (128–255)
  • STANDARD Classic ASCII (0–127)

Performance

Validates a string in O(n) time, where n is the number of UTF-16 code units. Early exits on the first invalid character.

Examples

isNoUnicode('Hello World!');       // true
isNoUnicode('Café');               // false (contains 'é')
isNoUnicode('Café', 'EXTENDED');   // true