Comparing version 1.18.0 to 1.19.0
@@ -197,5 +197,19 @@ import { CreditCardProvider } from './data/creditCardProviders'; | ||
export { CreditCardProvider }; | ||
export declare const creditCard: (options?: { | ||
export declare const creditCardNumber: (options?: { | ||
provider?: CreditCardProvider; | ||
}) => string; | ||
export declare const creditCardCVV: () => string; | ||
export declare const semver: () => string; | ||
export declare const month: (options?: { | ||
locale?: string; | ||
useAbbr?: boolean; | ||
}) => string; | ||
export declare const weekday: (options?: { | ||
locale?: string; | ||
useAbbr?: boolean; | ||
}) => string; | ||
export declare const date: (options?: { | ||
from?: Date; | ||
to?: Date; | ||
}) => Date; | ||
declare const _default: { | ||
@@ -348,6 +362,20 @@ setDefaultLocale: (locale: string) => void; | ||
}) => string; | ||
creditCard: (options?: { | ||
creditCardNumber: (options?: { | ||
provider?: CreditCardProvider; | ||
}) => string; | ||
creditCardCVV: () => string; | ||
semver: () => string; | ||
month: (options?: { | ||
locale?: string; | ||
useAbbr?: boolean; | ||
}) => string; | ||
weekday: (options?: { | ||
locale?: string; | ||
useAbbr?: boolean; | ||
}) => string; | ||
date: (options?: { | ||
from?: Date; | ||
to?: Date; | ||
}) => Date; | ||
}; | ||
export default _default; |
@@ -47,3 +47,5 @@ var __create = Object.create; | ||
country: () => country, | ||
creditCard: () => creditCard, | ||
creditCardCVV: () => creditCardCVV, | ||
creditCardNumber: () => creditCardNumber, | ||
date: () => date, | ||
default: () => src_default, | ||
@@ -69,2 +71,3 @@ direction: () => direction, | ||
macAddress: () => macAddress, | ||
month: () => month, | ||
name: () => name, | ||
@@ -76,2 +79,3 @@ number: () => number2, | ||
price: () => price, | ||
semver: () => semver, | ||
setDefaultLocale: () => setDefaultLocale, | ||
@@ -85,2 +89,3 @@ state: () => state, | ||
username: () => username, | ||
weekday: () => weekday, | ||
word: () => word, | ||
@@ -155,4 +160,3 @@ zipCode: () => zipCode | ||
]; | ||
var CreditCardProvider; | ||
(function(CreditCardProvider2) { | ||
var CreditCardProvider = /* @__PURE__ */ ((CreditCardProvider2) => { | ||
CreditCardProvider2["SOLO"] = "solo"; | ||
@@ -168,3 +172,4 @@ CreditCardProvider2["VISA"] = "visa"; | ||
CreditCardProvider2["AMERICAN_EXPRESS"] = "americanExpress"; | ||
})(CreditCardProvider || (CreditCardProvider = {})); | ||
return CreditCardProvider2; | ||
})(CreditCardProvider || {}); | ||
var creditCardProviders_default = { | ||
@@ -304,14 +309,14 @@ visa, | ||
}; | ||
var Gender; | ||
(function(Gender2) { | ||
var Gender = /* @__PURE__ */ ((Gender2) => { | ||
Gender2["MALE"] = "male"; | ||
Gender2["FEMALE"] = "female"; | ||
})(Gender || (Gender = {})); | ||
return Gender2; | ||
})(Gender || {}); | ||
var firstName = (options = {}) => { | ||
const { locale, gender } = options; | ||
switch (gender) { | ||
case Gender.FEMALE: | ||
case "female": | ||
const femaleFirstNames = getLocaleData({ locale, key: "femaleFirstNames" }); | ||
return arrayElement2(femaleFirstNames); | ||
case Gender.MALE: | ||
case "male": | ||
const maleFirstNames = getLocaleData({ locale, key: "maleFirstNames" }); | ||
@@ -351,4 +356,3 @@ return arrayElement2(maleFirstNames); | ||
}; | ||
var PlaceImgCategory; | ||
(function(PlaceImgCategory2) { | ||
var PlaceImgCategory = /* @__PURE__ */ ((PlaceImgCategory2) => { | ||
PlaceImgCategory2["ANY"] = "any"; | ||
@@ -360,10 +364,11 @@ PlaceImgCategory2["ANIMALS"] = "animals"; | ||
PlaceImgCategory2["TECH"] = "tech"; | ||
})(PlaceImgCategory || (PlaceImgCategory = {})); | ||
var PlaceImgFilter; | ||
(function(PlaceImgFilter2) { | ||
return PlaceImgCategory2; | ||
})(PlaceImgCategory || {}); | ||
var PlaceImgFilter = /* @__PURE__ */ ((PlaceImgFilter2) => { | ||
PlaceImgFilter2["GRAYSCALE"] = "grayscale"; | ||
PlaceImgFilter2["SEPIA"] = "sepia"; | ||
})(PlaceImgFilter || (PlaceImgFilter = {})); | ||
return PlaceImgFilter2; | ||
})(PlaceImgFilter || {}); | ||
var imageUrlFromPlaceIMG = (options) => { | ||
const { width, height, category, filter } = { category: PlaceImgCategory.ANY, ...options }; | ||
const { width, height, category, filter } = { category: "any", ...options }; | ||
const url = `https://placeimg.com/${width}/${height}/${category}`; | ||
@@ -434,4 +439,3 @@ if (filter) | ||
}; | ||
var WordType; | ||
(function(WordType2) { | ||
var WordType = /* @__PURE__ */ ((WordType2) => { | ||
WordType2["VERB"] = "verb"; | ||
@@ -444,3 +448,4 @@ WordType2["PREPOSITION"] = "preposition"; | ||
WordType2["ADJECTIVE"] = "adjective"; | ||
})(WordType || (WordType = {})); | ||
return WordType2; | ||
})(WordType || {}); | ||
var word = (options = {}) => { | ||
@@ -468,4 +473,3 @@ const { type, locale, filter } = options; | ||
}; | ||
var MacAddressSeparator; | ||
(function(MacAddressSeparator2) { | ||
var MacAddressSeparator = /* @__PURE__ */ ((MacAddressSeparator2) => { | ||
MacAddressSeparator2["NONE"] = ""; | ||
@@ -476,25 +480,26 @@ MacAddressSeparator2["DOT"] = "."; | ||
MacAddressSeparator2["SPACE"] = " "; | ||
})(MacAddressSeparator || (MacAddressSeparator = {})); | ||
var MacAddressTransmission; | ||
(function(MacAddressTransmission2) { | ||
return MacAddressSeparator2; | ||
})(MacAddressSeparator || {}); | ||
var MacAddressTransmission = /* @__PURE__ */ ((MacAddressTransmission2) => { | ||
MacAddressTransmission2["UNICAST"] = "unicast"; | ||
MacAddressTransmission2["MULTICAST"] = "multicast"; | ||
})(MacAddressTransmission || (MacAddressTransmission = {})); | ||
var MacAddressAdministration; | ||
(function(MacAddressAdministration2) { | ||
return MacAddressTransmission2; | ||
})(MacAddressTransmission || {}); | ||
var MacAddressAdministration = /* @__PURE__ */ ((MacAddressAdministration2) => { | ||
MacAddressAdministration2["LAA"] = "laa"; | ||
MacAddressAdministration2["UAA"] = "uaa"; | ||
})(MacAddressAdministration || (MacAddressAdministration = {})); | ||
return MacAddressAdministration2; | ||
})(MacAddressAdministration || {}); | ||
var macAddress = (options = {}) => { | ||
const { separator = MacAddressSeparator.COLON, transmission, administration } = options; | ||
const { separator = ":", transmission, administration } = options; | ||
const mac = array2(6, (index) => { | ||
let value = number2({ max: 255 }); | ||
if (index === 0) { | ||
if (transmission === MacAddressTransmission.MULTICAST) | ||
if (transmission === "multicast") | ||
value |= 1 << 0; | ||
else if (transmission === MacAddressTransmission.UNICAST) | ||
else if (transmission === "unicast") | ||
value &= ~(1 << 0); | ||
if (administration === MacAddressAdministration.LAA) | ||
if (administration === "laa") | ||
value |= 1 << 1; | ||
else if (administration === MacAddressAdministration.UAA) | ||
else if (administration === "uaa") | ||
value &= ~(1 << 1); | ||
@@ -504,3 +509,3 @@ } | ||
}); | ||
if (separator === MacAddressSeparator.DOT) { | ||
if (separator === ".") { | ||
let dotMac = ""; | ||
@@ -525,3 +530,3 @@ for (let i = 0; i < mac.length; i++) { | ||
const name2 = arrayElement2([ | ||
word({ locale, type: WordType.NOUN }), | ||
word({ locale, type: "noun" }), | ||
firstName({ locale }) | ||
@@ -577,7 +582,7 @@ ]); | ||
}; | ||
var DirectionType; | ||
(function(DirectionType2) { | ||
var DirectionType = /* @__PURE__ */ ((DirectionType2) => { | ||
DirectionType2["CARDINAL"] = "cardinal"; | ||
DirectionType2["ORDINAL"] = "ordinal"; | ||
})(DirectionType || (DirectionType = {})); | ||
return DirectionType2; | ||
})(DirectionType || {}); | ||
var direction = (options = {}) => { | ||
@@ -597,7 +602,7 @@ const { locale, type, useAbbr } = options; | ||
}; | ||
var CountryCodeType; | ||
(function(CountryCodeType2) { | ||
var CountryCodeType = /* @__PURE__ */ ((CountryCodeType2) => { | ||
CountryCodeType2["Alpha2"] = "alpha2"; | ||
CountryCodeType2["Alpha3"] = "alpha3"; | ||
})(CountryCodeType || (CountryCodeType = {})); | ||
return CountryCodeType2; | ||
})(CountryCodeType || {}); | ||
var country = (options = {}) => { | ||
@@ -607,5 +612,5 @@ const { locale, useCode } = options; | ||
switch (useCode) { | ||
case CountryCodeType.Alpha2: | ||
case "alpha2": | ||
return "countryCodesAlpha2"; | ||
case CountryCodeType.Alpha3: | ||
case "alpha3": | ||
return "countryCodesAlpha3"; | ||
@@ -626,3 +631,3 @@ default: | ||
}; | ||
var creditCard = (options = {}) => { | ||
var creditCardNumber = (options = {}) => { | ||
const { provider } = options; | ||
@@ -638,2 +643,28 @@ const providerFormats = provider ? creditCardProviders_default[provider] : Object.values(creditCardProviders_default).flat(); | ||
}; | ||
var creditCardCVV = () => { | ||
return array2(3, () => number2({ max: 9 })).join(""); | ||
}; | ||
var semver = () => { | ||
return [number2({ max: 9 }), number2({ max: 20 }), number2({ max: 99 })].join("."); | ||
}; | ||
var month = (options = {}) => { | ||
const { locale, useAbbr } = options; | ||
const months = getLocaleData({ locale, key: "months" }); | ||
const { wide, abbr } = months; | ||
return arrayElement2(useAbbr ? abbr : wide); | ||
}; | ||
var weekday = (options = {}) => { | ||
const { locale, useAbbr } = options; | ||
const weekdays = getLocaleData({ locale, key: "weekdays" }); | ||
const { wide, abbr } = weekdays; | ||
return arrayElement2(useAbbr ? abbr : wide); | ||
}; | ||
var date = (options = {}) => { | ||
const { from: _from, to: _to } = options; | ||
const from = _from || new Date(0); | ||
const to = _to || new Date(); | ||
const fromEpoch = from.getTime(); | ||
const toEpoch = to.getTime(); | ||
return new Date(number2({ min: fromEpoch, max: toEpoch })); | ||
}; | ||
var src_default = { | ||
@@ -685,3 +716,8 @@ setDefaultLocale, | ||
price, | ||
creditCard | ||
creditCardNumber, | ||
creditCardCVV, | ||
semver, | ||
month, | ||
weekday, | ||
date | ||
}; | ||
@@ -710,3 +746,5 @@ // Annotate the CommonJS export names for ESM import in node: | ||
country, | ||
creditCard, | ||
creditCardCVV, | ||
creditCardNumber, | ||
date, | ||
direction, | ||
@@ -731,2 +769,3 @@ domainName, | ||
macAddress, | ||
month, | ||
name, | ||
@@ -738,2 +777,3 @@ number, | ||
price, | ||
semver, | ||
setDefaultLocale, | ||
@@ -747,4 +787,5 @@ state, | ||
username, | ||
weekday, | ||
word, | ||
zipCode | ||
}); |
@@ -1636,2 +1636,56 @@ var __create = Object.create; | ||
// src/locales/fr/date/months.ts | ||
var months_default = { | ||
wide: [ | ||
"janvier", | ||
"f\xE9vrier", | ||
"mars", | ||
"avril", | ||
"mai", | ||
"juin", | ||
"juillet", | ||
"ao\xFBt", | ||
"septembre", | ||
"octobre", | ||
"novembre", | ||
"d\xE9cembre" | ||
], | ||
abbr: [ | ||
"janv.", | ||
"f\xE9vr.", | ||
"mars", | ||
"avril", | ||
"mai", | ||
"juin", | ||
"juil.", | ||
"ao\xFBt", | ||
"sept.", | ||
"oct.", | ||
"nov.", | ||
"d\xE9c." | ||
] | ||
}; | ||
// src/locales/fr/date/weekdays.ts | ||
var weekdays_default = { | ||
wide: [ | ||
"Dimanche", | ||
"Lundi", | ||
"Mardi", | ||
"Mercredi", | ||
"Jeudi", | ||
"Vendredi", | ||
"Samedi" | ||
], | ||
abbr: [ | ||
"Dim", | ||
"Lun", | ||
"Mar", | ||
"Mer", | ||
"Jeu", | ||
"Ven", | ||
"Sam" | ||
] | ||
}; | ||
// src/locales/fr/index.ts | ||
@@ -1655,3 +1709,5 @@ var defaultCurrency = "EUR"; | ||
countries: countries_default, | ||
defaultCurrency | ||
defaultCurrency, | ||
months: months_default, | ||
weekdays: weekdays_default | ||
}; | ||
@@ -1658,0 +1714,0 @@ import__.default.addLocale("fr", locale); |
{ | ||
"name": "minifaker", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"description": "lightweight faker.js", | ||
@@ -26,3 +26,3 @@ "types": "./dist/index.d.ts", | ||
"@types/jest": "^27.0.3", | ||
"esbuild": "^0.13.15", | ||
"esbuild": "^0.14.0", | ||
"jest": "^27.3.1", | ||
@@ -29,0 +29,0 @@ "jest-extended": "^1.1.0", |
@@ -119,2 +119,9 @@ # minifaker | ||
price|all|price with `Intl.NumberFormat` | ||
creditCardNumber|n/a|creditCard | ||
creditCardNumber|n/a|creditCardNumber | ||
creditCardCVV|n/a|creditCardCVV | ||
semver|n/a|semver | ||
password|n/a|use `generate-password` | ||
betweens|n/a|date | ||
month|en,fr|month | ||
weekday|en,fr|weekday | ||
date|all|date |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
606087
42947
127