1 min read74 views

Stop searching for fake data while prototyping of testing

Back in the days, I remember copying and pasting any kind of text I could find in the web to mock data without smashing my keyboard. While it works, there is a much better way to have valid data without leaving your code. I'm talking about faker. This npm package allows you to focus specifically on the type of data. That could be a lorem, firstname, address,... or even a random hex color. There is massive data to fake so checkout the GitHub respository for the data you need.

Here a glimpse of what is possible:

import faker from "faker";

const fullname = faker.name.findName(); // John Doe
const color = faker.internet.color(); // indigo
const paragraphs = faker.lorem.paragraphs(5); // This won't be a Lorem ipsum but 5 real paragraphs...

Et voilà, whenever you need data, install faker and you are good to go.