Comparing version 1.12.0 to 1.13.0
@@ -146,2 +146,6 @@ export declare const addLocale: (name: string, locale: any) => void; | ||
}) => string; | ||
export declare const zipCode: (options?: { | ||
locale?: string; | ||
format?: string; | ||
}) => string; | ||
declare const _default: { | ||
@@ -253,3 +257,7 @@ setDefaultLocale: (locale: string) => void; | ||
}) => string; | ||
zipCode: (options?: { | ||
locale?: string; | ||
format?: string; | ||
}) => string; | ||
}; | ||
export default _default; |
@@ -50,3 +50,4 @@ var __defProp = Object.defineProperty; | ||
username: () => username, | ||
word: () => word | ||
word: () => word, | ||
zipCode: () => zipCode | ||
}); | ||
@@ -340,2 +341,24 @@ var locales = {}; | ||
var domainUrl = (options = {}) => `https://${domainName(options)}`; | ||
var zipCode = (options = {}) => { | ||
const { locale, format: _format } = options; | ||
const alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; | ||
let format = _format; | ||
if (!format) { | ||
const formats = getLocaleData({ locale, key: "postCodeFormats" }); | ||
format = arrayElement(formats); | ||
} | ||
return format.split("").map((c) => { | ||
if (c === "#") | ||
return number({ max: 9 }).toString(); | ||
if (c === "?") | ||
return arrayElement(alphabet); | ||
if (c === "*") { | ||
if (boolean()) | ||
return arrayElement(alphabet); | ||
else | ||
return number({ max: 9 }).toString(); | ||
} | ||
return c; | ||
}).join(""); | ||
}; | ||
var src_default = { | ||
@@ -373,3 +396,4 @@ setDefaultLocale, | ||
email, | ||
domainUrl | ||
domainUrl, | ||
zipCode | ||
}; | ||
@@ -416,3 +440,4 @@ // Annotate the CommonJS export names for ESM import in node: | ||
username, | ||
word | ||
word, | ||
zipCode | ||
}); |
@@ -57,2 +57,24 @@ var __create = Object.create; | ||
// src/locales/fr_CA/address/postCodeFormats.ts | ||
var postCodeFormats_default = [ | ||
"A#? #?#", | ||
"B#? #?#", | ||
"C#? #?#", | ||
"E#? #?#", | ||
"G#? #?#", | ||
"H#? #?#", | ||
"J#? #?#", | ||
"K#? #?#", | ||
"L#? #?#", | ||
"M#? #?#", | ||
"N#? #?#", | ||
"P#? #?#", | ||
"R#? #?#", | ||
"S#? #?#", | ||
"T#? #?#", | ||
"V#? #?#", | ||
"X#? #?#", | ||
"Y#? #?#" | ||
]; | ||
// src/locales/fr_CA/index.ts | ||
@@ -62,3 +84,4 @@ var locale = { | ||
domainSuffixes: domainSuffixes_default, | ||
freeEmails: freeEmails_default | ||
freeEmails: freeEmails_default, | ||
postCodeFormats: postCodeFormats_default | ||
}; | ||
@@ -65,0 +88,0 @@ import__.default.addLocale("fr_CA", locale); |
@@ -1309,2 +1309,7 @@ var __create = Object.create; | ||
// src/locales/fr/address/postCodeFormats.ts | ||
var postCodeFormats_default = [ | ||
"#####" | ||
]; | ||
// src/locales/fr/index.ts | ||
@@ -1320,3 +1325,4 @@ var locale = { | ||
domainSuffixes: domainSuffixes_default, | ||
freeEmails: freeEmails_default | ||
freeEmails: freeEmails_default, | ||
postCodeFormats: postCodeFormats_default | ||
}; | ||
@@ -1323,0 +1329,0 @@ import__.default.addLocale("fr", locale); |
{ | ||
"name": "minifaker", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"description": "lightweight faker.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
@@ -106,1 +106,2 @@ # minifaker | ||
url|en,fr,fr_CA|domainUrl | ||
zipCode|en,fr,fr_CA|zipCode |
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
Sorry, the diff of this file is not supported yet
530914
38618
107