5 ms·
Faker.js - generate massive amounts of fake data in the browser and Node.js
- DoubleCluster 14y agoWhat's the use case for this? To annoy spammers?
- checktiput 14y agoDebug I suppose.
- dugmartin 14y agoI built something like this for an internal CMS framework and it really speed up prototyping pages - especially large list pages.
- Swizec 14y agoComing up with random words and examples when writing tests is surprisingly tedious.
- schumacher 14y agoCool. I recently build a similar thing for Magento to provide demo data and for anonymization purposes. Some parts of faker.js needs sure refactorings ...
- agotterer 14y agoI've been looking for something that can generate fake cart data. Is what you built open source?
- revorad 14y agoThis is fantastic. I was actually looking for something like this to test some APIs with dummy data.
- paavo 14y agoThe original such library was Perl's Data::Faker which was ported to Ruby as Faker gem (and later refactored to faster and more comprehensive Ffaker gem).
- qwerty69 14y agoVery nice library. It would be nice to add the ability to generate random values based on a distribution, e.g. the values are random but correspond to a normal distribution with a given mean and standard deviation. This would be very useful for testing statistical libraries and applications.
- SammoJ 14y agoWhich attributes would you sample from a normal distribution here? I don't see any numerical attributes where this would make sense. One could add weight, height, age etc. and sample from the relevant geographical/gender distributions?
- qwerty69 14y agoAn example would be the processing of automatically acquired measurement data. Such data usually shows some kind of distribution (binominal, normal, geometric, etc...) that needs to be taken into account when validating such a tool.
- DanBC 14y agoThis is cool. I'm gently disturbed that it generates valid email addresses. You pick a random name, follow it with an @, then add a random word, and then add a TLD. Obviously you're not responsible for how people use the tool. Best practice would be to use the domain example.com
- paavo 14y agoIn most use cases I can think of the generated data is used only in a closed (testing) environment and won't be visible to web crawlers and spambots. Many developers like me use these libraries for prototyping different UI views for their apps. Unfortunately, spammers do have way more advanced technologies to try and guess working addresses. Libraries like this generate mostly very improbable addresses: you would get way better results just by taking lists of most popular first names and family names and concatenating them with some well-known web mail providers.
- mindcrime 14y agoIn most use cases I can think of the generated data is used only in a closed (testing) environment and won't be visible to web crawlers and spambots. Many developers like me use these libraries for prototyping different UI views for their apps. The bigger problem, in my experience, is when you accidentally spam people yourself, while testing some function that somehow generates an outgoing email. I think almost everybody that's ever worked on code that sends emails has - at one time or another - ran a job that somehow wound up sending 6,712,374 "test" messages to every user in the production database. :-) Dummy addresses are better, but it's better still if they use @example.com so you know there's no way they'll actually get delivered to anybody.
- bpicolo 14y agoIf someone really wants to guess random addresses it isn't hard for them to write it themselves.
- tonyblundell 14y agoGreat, thanks!
- webfuel 14y agoThanks! I won't be using http://www.fakenamegenerator.com/ http://www.fakenamegenerator.com/ as much now.
- fruchtose 14y agoGreat project! I would, however, recommend an API with more namespaces. Functions like Address.ukCounty don't sit well with me; such an API would be a mess if you added support for countries other than the US and the UK. You could (and probably create namespaces for each country code, e.g.: Address |-> US |-> state |-> UK |-> state An alternative would be for country-specific generators to take a country code as an argument. I am not an experienced API designer, though, so take my comments with a heaping of salt.
- justwrote 14y agoShameless plug: I also created a similar library for Scala some time ago https://github.com/justwrote/scala-faker https://github.com/justwrote/scala-faker Need to update to 2.10 soon :)
- robbyishere 14y agoanjuna.js
- hawkw 14y agoSo many Node.js libraries....
- mindcrime 14y agoObligatory "I wrote something similar" post. But my tool is written in Java, doesn't run in the browser, but does use @example.com for the email addresses. https://github.com/mindcrime/dummydatagenerator https://github.com/mindcrime/dummydatagenerator