use-js-identifier 0.0.1

ASCII-safe JavaScript identifier primitives for RustUse
Documentation
  • Coverage
  • 53.33%
    8 out of 15 items documented1 out of 8 items with examples
  • Size
  • Source code size: 7.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 454.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-js
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-js-identifier

ASCII-safe JavaScript identifier primitives for RustUse.

Experimental

use-js-identifier is experimental while use-js remains below 0.3.0.

Example

use use_js_identifier::{JsIdentifier, is_valid_ascii_js_identifier};

let identifier = JsIdentifier::new("createApp")?;

assert_eq!(identifier.as_str(), "createApp");
assert!(is_valid_ascii_js_identifier("$value_1"));
# Ok::<(), use_js_identifier::JsIdentifierError>(())

Scope

  • Ordinary ASCII-safe JavaScript identifier validation.
  • $, _, ASCII letters, and ASCII digits in continuation positions.
  • Small newtype helpers for metadata models.

Non-goals

  • Complete Unicode ECMAScript identifier validation.
  • Keyword or reserved-word checks.
  • Source-code parsing.

Unicode-complete ECMAScript identifier validation is future work.

License

Licensed under either Apache-2.0 or MIT.