Git Product home page Git Product logo

Comments (6)

Rumi-Aguirre avatar Rumi-Aguirre commented on August 24, 2024 1

I've made a PR to solve this scenario. It would be great if you can check it :D

from slug-generator.

Rumi-Aguirre avatar Rumi-Aguirre commented on August 24, 2024

Any progress on this? it would be very nice to have this option. I really need it. The capability to override method replaceWithDelimiter (and others really) could be cool too, in order to allow extensibility of library

from slug-generator.

ausi avatar ausi commented on August 24, 2024

@Rumi-Aguirre can you describe your use case in detail? Maybe with some examples?

from slug-generator.

Rumi-Aguirre avatar Rumi-Aguirre commented on August 24, 2024

Sure!
I'm currently centralizing the logic of slug making and it must be backward compatible and I found the requirement that not allowed chars at the end of the input must be replaced by delimiter char but not trimmed. Some examples (input -> slug expected):

"sugiartoss_" -> "sugiartoss-"
"_sugiartoss_" -> "sugiartoss-"
"_sugiartoss-" -> "sugiartoss-"

assuming that delimiter is a dash "-"

from slug-generator.

ausi avatar ausi commented on August 24, 2024

"_sugiartoss_" -> "sugiartoss-"

so the behavior in the beginning of the string should be different than at the end of the string?

from slug-generator.

Rumi-Aguirre avatar Rumi-Aguirre commented on August 24, 2024

In this particular example I want to remove from begining but keep at the end but It would be nice if this behavior can be configured the same way that options like "delimiter" or "validChars". So can decide if want to trim the char just from beginning, from the end, from both or none to cover all use cases.

from slug-generator.

Related Issues (20)

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.