parse_global

Function parse_global 

Source
pub fn parse_global(s: &str) -> Result<String, String>
Expand description

Parse and validate a global variable name for IIFE bundles.

Ensures the name is a valid JavaScript identifier:

  • Must start with a letter, underscore, or dollar sign
  • Can contain letters, numbers, underscores, or dollar signs
  • Cannot be empty

§Examples

Valid identifiers: MyLibrary, _internal, $jquery, lib123 Invalid identifiers: 123abc, my-lib, my.lib, “”

§Errors

Returns an error message if the identifier is invalid.