Code Monkey home page Code Monkey logo

humanize_rs's People

Contributors

leopoldarkham avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

babariviere

humanize_rs's Issues

Allow Booleans to be parsed from languages other than English

Allow booleans to be parsed from languages other than English

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.

Re-export humansize

One-stop shopping is better than mentioning the other crate in the readme.

Clean up public hierarchy

Each module should contain one trait. Each trait should be pub used in lib.rs to flatten the hierarchy for users.

Add String Manipulation Module

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.