Giter Club home page Giter Club logo

Comments (6)

igas avatar igas commented on August 22, 2024

Yep, sounds good.

Ruby faker API looks reasonable:

# Optional arguments: words=nil, glue=nil
Faker::Internet.slug #=> "pariatur_laudantium"
Faker::Internet.slug('foo bar') #=> "foo.bar"
Faker::Internet.slug('foo bar', '-') #=> "foo-bar"

from faker.

tobyhinloopen avatar tobyhinloopen commented on August 22, 2024

In the ruby example, I don't get why the default case with 0 arguments, the slugs are "glued" with _ (underscore) and the 2nd example, glued with . (period). Is the "glue" random as well? I feel like - (dash) should be default.

But +1 for this addition

from faker.

anthonator avatar anthonator commented on August 22, 2024

@tobyhinloopen if you fixed it to a - how would you randomize it if that's what you wanted?

from faker.

anthonator avatar anthonator commented on August 22, 2024

This is my first attempt.

#80

I kept it pretty close to the Ruby implementation. The biggest difference is that you need to provide a list for the glue. This way we can provide a custom random glue.

from faker.

igas avatar igas commented on August 22, 2024

@tobyhinloopen I think that - is most common. but I feel like in this one better to have random, so ppl can find that they do not handle all the cases in specs for example, if they have their own slug format, they can get it with this. Thoughts?

from faker.

tobyhinloopen avatar tobyhinloopen commented on August 22, 2024

@igas Sounds right 👍

from faker.

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.