Crates.io | validate_npm_package_name |
lib.rs | validate_npm_package_name |
version | 0.1.0 |
source | src |
created_at | 2024-10-10 16:41:11.775374 |
updated_at | 2024-10-10 16:41:11.775374 |
description | A crate to validate npm package name |
homepage | https://github.com/Chersquwn/validate_npm_package_name |
repository | https://github.com/Chersquwn/validate_npm_package_name |
max_upload_size | |
id | 1404023 |
size | 16,273 |
A crate to validate npm package name
cargo add validate_npm_package_name
use validate_npm_package_name::validate;
validate(&String::from("some-package"));
validate(&String::from("@npm/abc"));
Validate Result
validate_npm_package_name::ValidateResult {
valid_for_new_packages: true,
valid_for_old_packages: true,
warnings: None,
errors: None
}
use validate_npm_package_name::validate;
validate(&String::from("s/l/a/s/h/e/s"));
Validate Result
validate_npm_package_name::ValidateResult {
valid_for_new_packages: true,
valid_for_old_packages: true,
warnings: None,
errors: Some(vec![String::from(
"name can only contain URL-friendly characters"
)])
}