GithubHelp home page GithubHelp logo

sindresorhus / humanize-string Goto Github PK

View Code? Open in Web Editor NEW
101.0 7.0 26.0 13 KB

Convert a camelized/dasherized/underscored string into a humanized one: fooBar-Baz_Faz → Foo bar baz faz

License: MIT License

JavaScript 90.12% TypeScript 9.88%

humanize-string's Introduction

humanize-string

Convert a camelized/dasherized/underscored string into a humanized one Example: fooBar-Baz_FazFoo bar baz faz

Install

npm install humanize-string

Usage

import humanizeString from 'humanize-string';

humanizeString('fooBar');
//=> 'Foo bar'

humanizeString('foo-bar');
//=> 'Foo bar'

humanizeString('foo_bar');
//=> 'Foo bar'

Related

  • camelcase - Convert a dash/dot/underscore/space separated string to camelcase

humanize-string's People

Contributors

bendingbender avatar richienb avatar sindresorhus avatar stoeffel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

humanize-string's Issues

Doesn't work in React Native app

This doesn't work on React Native apps, it gives you a really cryptic message. It works on android, android simulator, ios simulator, but doesn't work on physical iPhones.

Unhandled JS Exception: Invalid regular expression: invalid group specifier name

no stack

Please consider support for CommonJS

You can check this article:

https://formidable.com/blog/2022/victory-esm/

If you are a library author, please consider producing both ESM and CommonJS code in your packages and using package.json:exports to support both runtimes. If you’re already using a transpilation step like Babel or TypeScript, this should just prove to be a minor tweak to your build and publish scripts. If you’re only going to publish one form of code in your libraries, at this point in time, we advise that it be CommonJS — so that your library can continue to support both CommonJS and ESM upstream libraries and applications.

Lookbehind is unsupported in Safari

Hey this is a very useful package — thanks for publishing it! I did notice however that it doesn't seem to work correctly in Safari. At first glance it seems like the issue is being caused by decamelize and its use of lookbehind which isn't supported in Safari. Here's the error I am seeing in case this is something you want to address:

Screen Shot 2022-01-07 at 3 17 40 PM

Opt-out of lower-casing

Thanks for such great library!
Would be great to have ability to keep original letter case.

For example this string The-NetApp-Guide-to-Kubernetes is converted to boring The net app guide to kubernetes

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.