All Projects → g45t345rt → minifaker

g45t345rt / minifaker

Licence: other
A lightweight alternative to faker.js

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to minifaker

Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+53539.06%)
Mutual labels:  fake, faker
Joal
An open source command line RatioMaster with an optional WebUI.
Stars: ✭ 213 (+232.81%)
Mutual labels:  fake, faker
Fakerator
Random fake data generator with localization for Javascript in Node.js and browser
Stars: ✭ 91 (+42.19%)
Mutual labels:  fake, faker
Faker
A library for Dart that generates fake data.
Stars: ✭ 103 (+60.94%)
Mutual labels:  fake, faker
random
Random data generator AKA faker
Stars: ✭ 14 (-78.12%)
Mutual labels:  fake, faker
Bogus
📇 A simple and sane fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Stars: ✭ 5,083 (+7842.19%)
Mutual labels:  fake, faker
Fake Apache Log Generator
Generate a boatload of Fake Apache Log files very quickly
Stars: ✭ 207 (+223.44%)
Mutual labels:  fake, faker
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+5273.44%)
Mutual labels:  fake, faker
faker
Generate massive amounts of fake data in the browser and node.js
Stars: ✭ 6,940 (+10743.75%)
Mutual labels:  fake, faker
mkjson
A commandline tool to generate static or random JSON records
Stars: ✭ 16 (-75%)
Mutual labels:  fake, faker
FakerDotNet
A .NET port of the Ruby faker gem
Stars: ✭ 15 (-76.56%)
Mutual labels:  fake, faker
Faker.NET.Portable
C# port of the Ruby Faker gem (http://faker.rubyforge.org/)
Stars: ✭ 22 (-65.62%)
Mutual labels:  fake, faker
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+232.81%)
Mutual labels:  fake, faker
faker-buzzword-job-titles
👔 A job title generator for faker based on Buzzwords.
Stars: ✭ 14 (-78.12%)
Mutual labels:  fake, faker
xrm-mock
📚 A fake implementation of the Xrm object model. Written in TypeScript against @types/xrm definitions.
Stars: ✭ 64 (+0%)
Mutual labels:  fake
use-saga-reducer
Use redux-saga without redux
Stars: ✭ 72 (+12.5%)
Mutual labels:  generators
better-mock
Forked from Mockjs, Generate random data & Intercept ajax request. Support miniprogram.
Stars: ✭ 140 (+118.75%)
Mutual labels:  fake
blaver
A JavaScript library built on top of the Faker.JS library. It generates massive amounts of fake data in the browser and node.js.
Stars: ✭ 112 (+75%)
Mutual labels:  faker
dummy-products-api
An api to fetch dummy e-commerce product 👕 👗 👖 👚 JSON data with placeholder images.
Stars: ✭ 102 (+59.38%)
Mutual labels:  fake
awesome-web-online-tools
Many many useful Web Online Tools For Web Developers&Programmers
Stars: ✭ 13 (-79.69%)
Mutual labels:  fake

minifaker

Generate fake data.
An alternative to faker.js with both esm and cjs syntax https://github.com/Marak/faker.js

NPM

npm i minifaker

Supported locales

en | fr, fr-CA | es

Why

faker.js is big, does not support tree shaking and is not in Typescript https://github.com/Marak/faker.js/issues/785

On 2021/01/05, Marak deleted fakerjs from npm and github.

Why not create a pull request to faker.js?

Supporting ES6 modules for faker.js would need a big restructure change.

Right now, I just need a couple of functions and it's faster to create a new package mirroring functions without having to do a lot of refactoring. However, importing the entire package will take work and time, but at least I can start using it without having to finish it.

I also want to use Typescript and introduce new functions.

Duplicates

I've notice that faker locales have duplicate words :S.
I'll try fix the duplicates when importing locale files to reduce size as much as possible.

Replacing old functions with new powerful packages instead

  • nanoid, uuid

Example / usage

Using functions

// You can either import minifaker completely 
// or import the functions you need
import minifaker, { arrayElement } from 'minifaker'
// const minifaker = require('minifaker')

minifaker.number()
arrayElement(['one', 'two', 'three'])

Using locale dependent functions

import minifaker, { cityName } from 'minifaker'
// There is no default locale import (not even `english`)
import 'minifaker/locales/en' // the first locale import is set as default
import 'minifaker/locales/fr'

minifaker.firstName({ gender: 'female' }) // female name in english
cityName({ locale: 'fr' }) // french city name

Generating a list of 50 english names

import { array, name } from 'minifaker'
import 'minifaker/locales/en'

array(50, () => name())

Generating english words

import { word } from 'minifaker'
import 'minifaker/locales/en'

word() // Can be an adjective, adverb, conjunction, interjection, noun, preposition, verb
word({ filter: (word) => word.length > 5 }) // Word with at least 5 characters
word({ type: 'noun' }) // A noun

Word types

verb,preposition,noun, interjection, conjunction, adverb, adjective

Direct access to more performant/popular packages

import { nanoId, uuid, nonsecure } from 'minifaker'

nanoId.nanoid() // nanoid - https://github.com/ai/nanoid
nonsecure.nanoid() // nanoid/non-secure - https://github.com/ai/nanoid/blob/main/non-secure/index.js
uuid.v4() // uuid - https://github.com/uuidjs/uuid

Function mapping

Faker.js Locales Func
random.arrayElement n/a arrayElement
random.number,random.float n/a number
random.boolean n/a boolean
random.uuid n/a uuid -> uuid funcs
n/a n/a nanoid -> nanoId funcs
name.firstName en,fr firstName
phone.phoneNumber en,fr,fr-CA phoneNumber
address.cityName en,fr cityName
address.cityPrefix en cityPrefix
address.citySuffix en citySufix
image.imageUrl n/a imageUrlFromPlaceIMG
image.imageUrl n/a imageUrlFromPlaceholder
lorem n/a todo
random.objectElement n/a objectElement
n/a n/a array
name.lastName en,fr lastName
name.jobTitle en jobTitle
name.jobArea en jobArea
name.jobDescriptor en jobDescriptor
name.jobType en,fr jobType
n/a en,fr name
internet.ip n/a ip
internet.port n/a port
adjective,adverb,conjunction,interjection,noun,preposition,verb en word
internet.ipv6 n/a ipv6
internet.color n/a color
internet.username en,fr username
internet.mac n/a macAddress
internet.domainName en,fr,fr-CA domainName
internet.domainSuffix en,fr,fr-CA domainSuffix
internet.email en,fr,fr-CA email
internet.url en,fr,fr-CA domainUrl
address.zipCode en,fr,fr-CA zipCode
address.streetPrefix fr streetPrefix
address.streetSuffix en,fr streetSuffix
address.streetName en,fr streetName
address.streetAddress en,fr streetAddress
address.timeZone en timeZone
address.latitude n/a latitude
address.longitude n/a longitude
n/a n/a latLong
address.direction,address.cardinalDirection,address.ordinalDirection en,fr direction
address.state,address.stateAbbr en,es state
address.country,address.countryCode en,fr country
commerce.price all price with Intl.NumberFormat
finance.creditCardNumber n/a creditCardNumber
finance.creditCardCVV n/a creditCardCVV
system.semver n/a semver
internet.password n/a password
date.month en,fr month
date.weekday en,fr weekday
date all date
finance.bitcoinAddress n/a bitcoinAddress
system.fileExt,commonFileExt n/a fileExt
system.fileName,commonFileName en fileName
system.filePath en filePath
system.mimeType,commonMimeType n/a mimeType
system.dirPath n/a dirPath
seed n/a setSeed
hexaDecimal n/a hex
address.county en county
address.province fr,es,fr-CA province
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].