polyvalid
is a Rust library for validating package names, usernames, namespace names, and app names. The library provides a single source of truth for validating the names with the following rules:
_
or -
Additionally, the library checks if the name contains --
since it can break URL rules.
The library can be used from Python and JS through the provided bindings.
The library can be used from rust, python or javascript. The following describes how to use it from all three languages.
bash
cargo add polyvalid
```rust use polyvalid;
let name: String = "polyvalid";
assert!(polyvalid::isappname_valid(name)); ```
bash
pip add polyvalid
```python import polyvalid
name = "polyvalid" polyvalid.isappname_valid(name) # returns True ```
bash
npm i polyvalid
js
import "polyvalid";
name = "polyvalid";
polyvalid.is_valid_name(name); // returns true
Contributions are welcome! If you'd like to contribute to polyvalid
, please follow these steps:
polyvalid
repo.