leopoldarkham / humanize_rs Goto Github PK
View Code? Open in Web Editor NEWHumanize_rs - A simple humanization library for Rust
Humanize_rs - A simple humanization library for Rust
One-stop shopping is better than mentioning the other crate in the readme.
Currently some languages are left unimplemented. Many more need to be added altogether.
Yay.
Add a string manipulation module that is relatively equivalent in functionality to the string related functions found in https://github.com/HubSpot/humanize
These should be defined in a trait implemented for string types, like in the other modules.
Truncate after X characters
Truncate after X words
Capitalize
Title case
Convert to and from snake case, camel case, etc
Pluralize
nl2br and br2nl
Anything else?
1.times() == "once"
3.times() == "three times"
etc
Each module should contain one trait. Each trait should be pub use
d in lib.rs to flatten the hierarchy for users.
It would be nice to allow for Boolean parsing from other languages.
This could be done several ways:
Add to_bool_with_language(maps_to_true, maps_to_false)
that takes two user defined arrays describing what's true and what's false. Meh.
Add to_bool_with_language(lang_tag)
that takes a language tag and parses accordingly. Nicer, but makes it hard to allow multiple languages at a time.
Add a global switch that enables/disables languages. The to_bool
function interacts with this behind the scenes to parse accordingly.
e.g.
Humanize::enable_lang("English");
Humanize::enable_lang("Spanish");
"yes".to_bool(); // Works
"si".to_bool() // Works too
I think I like this the most.
Pick one of the strategies and implement it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.