Giter VIP home page Giter VIP logo

recase's People

Contributors

am-kantox avatar bluecollarchris avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar elielhaouzi avatar iporsut avatar jhchen avatar kianmeng avatar mralexlau avatar ndreynolds avatar rbino avatar sobolevn avatar teedang19 avatar tildewill 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

recase's Issues

Add sentence case

Sentence case works like so:

  • Some Random Value -> Some random value
  • some_random_value -> Some random value

Handle atom inputs

What do you think about also handling atom inputs? I'm happy to make a PR to implement this enhancement if you're on board.

Maps that are not Enumerable

Hello!

When using Recase.Enumerable.convert_keys, it tries to recursively convert keys in maps. The problem is that not every map has Enumerable protocol implementation, so it raises if it finds for example DateTime struct.

Guess we could check if Enumerable is implemented?

Recase logo offer

Hello! I am a graphic designer. I contribute to open source software. I saw the logo in the Readme File. I wanted to customize the logo. You can be sure I can do better. Do you want to see my new logo idea?

I will wait for feedback. Have a nice day!

`to_camel` only capitalizes last word if given camel cased input

to_camel produces unexpected output when given an existing camel case string. This seems to happen when the given string has more than 2 words in it:

Recase.to_camel("fooBar")
> "fooBar" # Correct

Recase.to_camel("fooBarBaz")
> "foobarBaz" # Incorrect, this should be "fooBarBaz"

Recase.to_camel("fooBarBazBiz")
> "foobarbazBiz" # Incorrect, this should be "fooBarBazBiz"

Removing punctuation

From the Wikipedia page linked from kebab_case.ex it says "As per snake_case above" and in the snake_case section above it says "Punctuation is removed and spaces are replaced..." However it looks like in this project's tests for kebab_case it seems to intentionally test for preservation of punctuation https://github.com/sobolevn/recase/blob/master/test/recase_test/kebab_case_test.exs#L18

My understanding of kebab case (and other cases) is that punctation should be removed and consecutive punctation is collapsed into one hyphen. This is for example what lodash does for their string conversion suite and this definition of kebab case seems supported by this project's own comment link to Wikipedia.

So for one I wanted to ask to clarify on what is the correct behavior. If punctuation should be preserved then the link to Wikipedia should be removed as it does not describe the functionality of the functions implemented by this project. If they should be removed then I'm happy to submit a PR changing this and updating the tests.

In case it is helpful the use case I have is generating urls for titles (user generated) and preserving punctation is of course problematic for urls.

Recase.to_snake/1 is not consistent with previous versions (<0.4.0)

We have seen a compatibility break from versions 0.5.0+ in Recase.to_snake/1. This happens when there are multiple uppercase letters followed by lowercase ones as you can see in the example with "CurrencyISOCode":

Versions 0.5+

iex(2)> Recase.to_snake("CurrencyISOCode")
"currency_isocode"

Previos versions <= 0.4

iex(2)> Recase.to_snake("CurrencyISOCode")
"currency_iso_code"

Is that intended? For the moment we are pinning the dependency to v0.4.0

Missing to_title function and TitleCase module

This is really baffling. Obviously I see both here on Github, but if add the {:recase, "~> 0.4"} dependency, fetch it with mix deps.get, and then go spelunking into the deps/recase/... directory both the function and module are missing. Is this some kind of hex bug?

0.7.0

Hi @sobolevn,

Can you tag the current master version ? is there a specific reason not publish a new tag ?

Thanks

You cannot circularly convert camel to snake

I came here because Macro has the same problem, and it's frustrating with how it's used inside Absinthe but isn't circular. I was hoping to find another lib that did it right, but...alas, this lib has the same broken functionality when you have acronyms with mulitiple cases in a row:

iex> "power1VA" |> Recase.to_snake |> Recase.to_camel
"power1Va"

What I'd expect is Recase.to_snake converts it to "power1_v_a"

Is this something this library would like to fix? I can look into the code if so.

Consider using digits as separator in snake and related cases

Currently digits do not break up tokens in snake case and other (kebab case, dot case, constant case) so SnakeCase.convert("g2g") == "g2g". This is different from other implementations such as Lodash where _.lodash("g2g") === "g_2_g". I could not find an authoritative description of snake case as to which is the expected behavior but given the prevalence of Lodash, following its behavior might end up causing less surprise for developers/users.

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.