Skip to content

parse-author v0.1.0

Latest

Choose a tag to compare

@trananhtung trananhtung released this 22 Jun 09:15

First release.

Parse an npm-style author string — "Name <email> (url)" — into its name, email, and url. A faithful Rust port of the parse-author npm package (and the author-regex it is built on).

use parse_author::parse_author;
let a = parse_author("Jon Schlinkert <jon@example.com> (https://github.com/jonschlinkert)");
assert_eq!(a.name.as_deref(), Some("Jon Schlinkert"));
assert_eq!(a.email.as_deref(), Some("jon@example.com"));
assert_eq!(a.url.as_deref(), Some("https://github.com/jonschlinkert"));
  • parse_author(input) -> Author { name, email, url } (each Option<String>)
  • The opening bracket decides the field (<…> email, (…) url); unmatched shapes yield an empty Author
  • Zero dependencies; #![no_std]

Differential-tested against the real node parse-author: 0 mismatches over 11039 author strings (including the subtle multi-delimiter whitespace rule, cross-brackets, and NEL/BOM edge cases), plus a panic fuzz.

Fills a real gap — useful for package.json tooling (license/SBOM checkers, registry tools).

📦 https://crates.io/crates/parse-author