Comparing version 1.25.0 to 1.26.0
@@ -0,2 +1,8 @@ | ||
import _nanoid from 'nanoid'; | ||
import * as _uuid from 'uuid'; | ||
import _generatePassword from 'generate-password'; | ||
import { CreditCardProvider } from './data/creditCardProviders'; | ||
export declare const nanoId: typeof _nanoid; | ||
export declare const uuid: typeof _uuid; | ||
export declare const password: typeof _generatePassword; | ||
export declare const addLocale: (name: string, locale: any) => void; | ||
@@ -385,3 +391,6 @@ export declare const setDefaultLocale: (locale: string) => void; | ||
setSeed: (seed: string) => void; | ||
nanoId: typeof _nanoid; | ||
uuid: typeof _uuid; | ||
password: typeof _generatePassword; | ||
}; | ||
export default _default; |
@@ -533,3 +533,3 @@ var __create = Object.create; | ||
var width = 256, chunks = 6, digits = 52, rngname = "random", startdenom = math.pow(width, chunks), significance = math.pow(2, digits), overflow = significance * 2, mask = width - 1, nodecrypto; | ||
function seedrandom2(seed, options, callback) { | ||
function seedrandom(seed, options, callback) { | ||
var key = []; | ||
@@ -646,3 +646,3 @@ options = options == true ? { entropy: true } : options || {}; | ||
if (typeof module2 == "object" && module2.exports) { | ||
module2.exports = seedrandom2; | ||
module2.exports = seedrandom; | ||
try { | ||
@@ -654,6 +654,6 @@ nodecrypto = require("crypto"); | ||
define(function() { | ||
return seedrandom2; | ||
return seedrandom; | ||
}); | ||
} else { | ||
math["seed" + rngname] = seedrandom2; | ||
math["seed" + rngname] = seedrandom; | ||
} | ||
@@ -736,4 +736,6 @@ })(typeof self !== "undefined" ? self : exports, [], Math); | ||
name: () => name, | ||
nanoId: () => nanoId, | ||
number: () => number, | ||
objectElement: () => objectElement, | ||
password: () => password, | ||
phoneNumber: () => phoneNumber, | ||
@@ -751,2 +753,3 @@ port: () => port, | ||
username: () => username, | ||
uuid: () => uuid, | ||
weekday: () => weekday, | ||
@@ -757,2 +760,5 @@ word: () => word, | ||
var import_seedrandom = __toModule(require_seedrandom2()); | ||
var import_nanoid = __toModule(require("nanoid")); | ||
var _uuid = __toModule(require("uuid")); | ||
var import_generate_password = __toModule(require("generate-password")); | ||
@@ -1065,2 +1071,5 @@ // src/data/creditCardProviders.ts | ||
}; | ||
var nanoId = import_nanoid.default; | ||
var uuid = _uuid; | ||
var password = import_generate_password.default; | ||
var addLocale = (name2, locale) => { | ||
@@ -1527,3 +1536,6 @@ const noLocales = Object.keys(locales).length === 0; | ||
fileName, | ||
setSeed | ||
setSeed, | ||
nanoId, | ||
uuid, | ||
password | ||
}; | ||
@@ -1581,4 +1593,6 @@ // Annotate the CommonJS export names for ESM import in node: | ||
name, | ||
nanoId, | ||
number, | ||
objectElement, | ||
password, | ||
phoneNumber, | ||
@@ -1596,2 +1610,3 @@ port, | ||
username, | ||
uuid, | ||
weekday, | ||
@@ -1598,0 +1613,0 @@ word, |
{ | ||
"name": "minifaker", | ||
"version": "1.25.0", | ||
"version": "1.26.0", | ||
"description": "lightweight faker.js", | ||
@@ -13,3 +13,3 @@ "types": "./dist/index.d.ts", | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test": "jest", | ||
"build": "ts-node bundle.ts && tsc ./src/index.ts --declaration --emitDeclarationOnly --downlevelIteration --esModuleInterop --outdir dist", | ||
@@ -29,4 +29,6 @@ "prepublishOnly": "npm run build" | ||
"esbuild": "^0.14.2", | ||
"generate-password": "^1.7.0", | ||
"jest": "^27.4.4", | ||
"jest-extended": "^1.2.0", | ||
"seedrandom": "^3.0.5", | ||
"ts-jest": "^27.1.1", | ||
@@ -36,4 +38,6 @@ "ts-node": "^10.4.0" | ||
"dependencies": { | ||
"seedrandom": "^3.0.5" | ||
"@types/uuid": "^8.3.4", | ||
"nanoid": "^3.1.30", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
133
README.md
@@ -17,5 +17,7 @@ # minifaker | ||
faker.js is too big and it's not currently supporting tree shaking. | ||
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? | ||
@@ -29,10 +31,2 @@ | ||
### Better function alternatives | ||
I will deprecate functions with better alternatives. | ||
- instead of `uuid()` use `npm i nanoid` to generate string ID | ||
- instead of `lorem()` use `npm i lorem-ipsum` to generate lorem words | ||
- instead of `password()` use `npm i generate-password` to generate unique passwords | ||
### Duplicates | ||
@@ -43,2 +37,6 @@ | ||
### Replacing old functions with new powerful packages instead | ||
- nanoid, uuid, generate-password | ||
## Example / usage | ||
@@ -79,2 +77,12 @@ | ||
### Direct access to more performant/popular packages | ||
```ts | ||
import { nanoid, uuid, password } from 'minifaker' | ||
nanoid.nanoid() | ||
uuid.v4() | ||
password.generate() | ||
``` | ||
## Function mapping | ||
@@ -84,59 +92,60 @@ | ||
|-|-|-| | ||
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 | ||
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 | ||
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 | ||
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 | ||
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 | ||
email|en,fr,fr-CA|email | ||
url|en,fr,fr-CA|domainUrl | ||
zipCode|en,fr,fr-CA|zipCode | ||
streetPrefix|fr|streetPrefix | ||
streetSuffix|en,fr|streetSuffix | ||
streetName|en,fr|streetName | ||
streetAddress|en,fr|streetAddress | ||
timeZone|en|timeZone | ||
latidude|n/a|latidude | ||
longitude|n/a|longitude | ||
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.latidude|n/a|latidude | ||
address.longitude|n/a|longitude | ||
n/a|n/a|latLong | ||
direction,cardinalDirection,ordinalDirection|en,fr|direction | ||
state,stateAbbr|en,fr,fr-CA|state | ||
country,countryCode|en,fr|country | ||
price|all|price with `Intl.NumberFormat` | ||
creditCardNumber|n/a|creditCardNumber | ||
creditCardCVV|n/a|creditCardCVV | ||
semver|n/a|semver | ||
password|n/a|use `generate-password` | ||
month|en,fr|month | ||
weekday|en,fr|weekday | ||
address.direction,address.cardinalDirection,address.ordinalDirection|en,fr|direction | ||
address.state,address.stateAbbr|en,fr,fr-CA|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 -> `generate-password` funcs | ||
date.month|en,fr|month | ||
date.weekday|en,fr|weekday | ||
date|all|date | ||
bitcoinAddress|n/a|bitcoinAddress | ||
fileExt,commonFileExt|n/a|fileExt | ||
fileName,commonFileName|en|fileName | ||
filePath|en|filePath | ||
mimeType,commonMimeType|n/a|mimeType | ||
dirPath|n/a|dirPath | ||
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 |
Sorry, the diff of this file is not supported yet
831329
55603
147
3
9
+ Added@types/uuid@^8.3.4
+ Addednanoid@^3.1.30
+ Addeduuid@^8.3.2
+ Added@types/uuid@8.3.4(transitive)
+ Addednanoid@3.3.8(transitive)
+ Addeduuid@8.3.2(transitive)
- Removedseedrandom@^3.0.5
- Removedseedrandom@3.0.5(transitive)