Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
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 |
citySuffix | 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,adverb,conjunction, interjection,noun,preposition,verb | en | word |
ipv6 | n/a | ipv6 |
color | n/a | color |
username | en,fr | username |
mac | n/a | macAddress |
domainName | en,fr,fr_CA | domainName |
domainSuffix | en,fr,fr_CA | domainSuffix |
en,fr,fr_CA | ||
url | en,fr,fr_CA | domainUrl |
FAQs
lightweight faker.js
The npm package minifaker receives a total of 18,203 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.