mazey
    Preparing search index...

    Function toJavaScriptGlobalName

    • Convert text to a deterministic uppercase ASCII JavaScript identifier.

      Characters outside A-Z, a-z, 0-9, _, and $ become _. A result beginning with a digit is prefixed with _; an empty input therefore returns _.

      Usage:

      import { toJavaScriptGlobalName } from "mazey";

      const globalName = toJavaScriptGlobalName("@scope/my-library");
      console.log(globalName);

      Output:

      _SCOPE_MY_LIBRARY
      

      Parameters

      • value: string

        Text such as a package name or bundle filename.

      Returns string

      An uppercase identifier suitable for an IIFE global name.

      TypeError when value is not a string.