Crates.io | valid_npm_name |
lib.rs | valid_npm_name |
version | 0.1.1 |
source | src |
created_at | 2024-05-23 01:59:23.805472 |
updated_at | 2024-05-23 03:09:10.197698 |
description | Check whether a package name is a valid npm package name |
homepage | https://github.com/cijiugechu/valid_npm_name |
repository | https://github.com/cijiugechu/valid_npm_name |
max_upload_size | |
id | 1249021 |
size | 41,484 |
valid_npm_name
Check whether a package name is a valid npm package name.
use valid_npm_name::ValidName;
fn main() {
let foo = ValidName::parse("foo").unwrap();
assert_eq!("foo", foo.to_string());
let bar_name = ValidName::parse("bar").unwrap();
let bar = bar_name.as_ref();
assert_eq!("bar", bar);
let baz = ValidName::parse("baz").unwrap();
assert_eq!("baz", baz.as_str());
}