Ramda: Any chance of implementing kebabCase?

Created on 19 Jun 2018  路  3Comments  路  Source: ramda/ramda

Compared to lodash, ramda doesn't have kebabCase functionality.

Wondering why it hasn't implemented yet.

(Just for curiosity. If rambda Project's directional doesn't match with adding bunch of String manipulate functions, It's totally fine. Respect that.)

Most helpful comment

All 3 comments

Hi @DanielTimLee, thanks for the issue. I think ramda-extension is a better place for this function. It's a little too specific and high level to be introduced into Ramda, but we can leave this open to see what sort of interest it garners.

Compared to lodash, ramda doesn't have kebabCase functionality.

Wondering why it hasn't implemented yet.

We don't look to lodash, or Underscore, or really any other JS libraries for inspiration. Our goals are different, our basic philosophy is different, and our focus is different. So the fact that a function is in lodash makes no difference as to whether we'll include it.

While we do take inspiration from ML-style and LISP-style languages as well as Erlang, we're also not trying to port their APIs either.

I agree with @Bradcomp: this makes more sense in ramda-extension, ramda-adjunct, and/or the Cookbook. And of course there's a million implementations available on the web if you need one. Or here's an untested million-and-first:

const kebabCase = s => s.replace(/([A-Z])/g, ' $1')
                        .replace(/(\W+)/g, '-')
                        .replace(/^-|-$/g, '')
                        .toLowerCase()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

woss picture woss  路  3Comments

ldk18501 picture ldk18501  路  3Comments

FranzSkuffka picture FranzSkuffka  路  3Comments

corporatepiyush picture corporatepiyush  路  4Comments

sugoidesune picture sugoidesune  路  3Comments