Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
The faker npm package is a powerful tool for generating massive amounts of fake data in Node.js and the browser. It is commonly used for testing, bootstrapping databases, and creating realistic-looking UI prototypes. Faker can generate data for various categories, including names, addresses, phone numbers, dates, and more.
Generating Names
Generates a random full name. Useful for creating user profiles or contact lists in testing environments.
faker.name.findName();
Generating Addresses
Produces a random street address. This can be used to test address forms or display sample addresses on a map.
faker.address.streetAddress();
Generating Internet-related Information
Creates a random email address. Ideal for testing email validation or populating a database with unique user emails.
faker.internet.email();
Generating Lorem Ipsum Text
Generates random 'Lorem Ipsum' text. This is particularly useful for designers and developers who want to fill their layouts with placeholder text to check text formatting and layouts.
faker.lorem.paragraphs();
Generating Random Numbers
Generates a random number within a specified range. This can be used for creating randomized data points for testing calculations or generating mock analytics data.
faker.random.number({ min: 1, max: 100 });
Chance is a minimalist generator of random strings, numbers, etc. to help reduce some monotony particularly while writing automated tests or anywhere else you need anything random. It is somewhat similar to faker but with a focus on simplicity and smaller size.
Casual is a fake data generator for JavaScript that aims to provide an easy way to generate random data for various types of information, similar to faker. It differentiates itself with a more straightforward API and the ability to define custom generators.
Mockaroo is not an npm package but a web service that allows you to generate large datasets of fake data for testing and development. Unlike faker, which is a library you integrate into your code, Mockaroo is used via its website or API to create data based on your specifications.
<script src = "faker.js" type = "text/javascript"></script>
<script>
var randomName = faker.name.findName(); // Caitlyn Kerluke
var randomEmail = faker.internet.email(); // Rusty@arne.info
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
</script>
var faker = require('./faker');
var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
As of version v2.0.0
faker.js supports 27 different language definition packs.
The default language is set to English.
Setting a new locale is simple:
// sets locale to de
faker.locale = "de";
Read further for complete list of locales.
npm install .
make test
You can view a code coverage report generated in coverage/lcov-report/index.html.
####Matthew Bergman & Marak Squires
faker.js was inspired by and has used data definitions from
https://github.com/stympy/faker/ - Copyright (c) 2007-2010 Benjamin Curtis
http://search.cpan.org/~jasonk/Data-Faker-0.07/ - Copyright 2004-2005 by Jason Kohles
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Generate massive amounts of fake contextual data
The npm package faker receives a total of 1,516,093 weekly downloads. As such, faker popularity was classified as popular.
We found that faker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.