
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Generate fake data.
An alternative to faker.js but with cjs or esm syntax
https://github.com/Marak/faker.js
npm i minifaker
faker.js is too big and it's not currently supporting tree shaking. https://github.com/Marak/faker.js/issues/785
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.
I will deprecate functions with better alternatives.
npm i nanoid
to generate string IDnpm i lorem-ipsum
to generate lorem wordsI'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.
// 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'])
import minifaker, { cityName, Gender } from 'minifaker'
// There is no default locale import (not even `english`)
import 'minifaker/dist/locales/en' // the first locale import is set as default
import 'minifaker/dist/locales/fr'
minifaker.firstName({ gender: Gender.FEMALE }) // female name in english
cityName({ locale: 'fr' }) // french city name
import { array, name } from 'minifaker'
import 'minifaker/dist/locales/en'
array(50, () => name())
Faker.js | Locales | Func |
---|---|---|
arrayElement | n/a | arrayElement |
number,float | n/a | number |
boolean | n/a | boolean |
uuid | n/a | use nanoid |
firstName | en,fr | firstName |
phoneNumber | en,fr,fr_CA | phoneNumber |
cityName | en,fr | cityName |
cityPrefix | en | cityPrefix |
citySufix | en | citySufix |
imageUrl | n/a | imageUrlFromPlaceIMG |
imageUrl | n/a | imageUrlFromPlaceholder |
lorem | n/a | use lorem-ipsum |
objectElement | n/a | objectElement |
n/a | n/a | array |
lastName | en,fr | lastName |
jobTitle | en | jobTitle |
jobArea | en | jobArea |
jobDescriptor | en | jobDescriptor |
jobType | en,fr | jobType |
name | en,fr | name |
ip | n/a | ip |
port | n/a | port |
adjective | en | adjective |
FAQs
lightweight faker.js
The npm package minifaker receives a total of 68,272 weekly downloads. As such, minifaker popularity was classified as popular.
We found that minifaker 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.