Comments (6)
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.
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.
@tobyhinloopen if you fixed it to a -
how would you randomize it if that's what you wanted?
from faker.
This is my first attempt.
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.
@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.
@igas Sounds right 👍
from faker.
Related Issues (20)
- New release? HOT 1
- Problems when instantiating Faker in iex, I followed the documentation guide but it didn't help me much, can someone help me, I'm using Phoenix Framework HOT 2
- Faker.Name.PtBr.first_name/0 is undefined HOT 2
- Avatar url is redirected HOT 1
- Virgin Islands extra split
- Faker.Phone.EnUs.phone() produces invalid phone numbers HOT 2
- Feature request: Timezone
- Utilities for non-deterministic data generation
- Compile issue with Elixir 1.13 HOT 5
- invalid bidirectional formatting character in string: \u202A HOT 2
- compile error on elixir latest 1.13.12 HOT 2
- Faker.Blockchain.Ethereum.address/0 may return invalid addresses HOT 1
- Option to make any generated data unique HOT 1
- Faker.Vehicle.vin() does not always generate valid VINs
- feature: increase API compatibility with FakerElixir
- Release new version HOT 2
- Dependency Dashboard
- Faker.Date.date_of_birth() is failing on 29/2 HOT 5
- Faker.Date.date_of_birth() generates invalid dates when called on a leap date HOT 2
- Compile warnings with Elixir 1.17 rc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faker.