Comparing version 1.11.0 to 1.12.0
@@ -36,3 +36,3 @@ export declare const addLocale: (name: string, locale: any) => void; | ||
}) => string; | ||
export declare const citySufix: (options?: { | ||
export declare const citySuffix: (options?: { | ||
locale?: string; | ||
@@ -109,2 +109,4 @@ }) => string; | ||
type?: number; | ||
firstName?: string; | ||
lastName?: string; | ||
}) => string; | ||
@@ -131,2 +133,17 @@ export declare enum MacAddressSeparator { | ||
}) => string; | ||
export declare const email: (options?: { | ||
locale?: string; | ||
firstName?: string; | ||
lastName?: string; | ||
provider?: string; | ||
}) => string; | ||
export declare const domainName: (options?: { | ||
locale?: string; | ||
}) => string; | ||
export declare const domainSuffix: (options?: { | ||
locale?: string; | ||
}) => string; | ||
export declare const domainUrl: (options?: { | ||
locale?: string; | ||
}) => string; | ||
declare const _default: { | ||
@@ -138,3 +155,3 @@ setDefaultLocale: (locale: string) => void; | ||
}) => string; | ||
citySufix: (options?: { | ||
citySuffix: (options?: { | ||
locale?: string; | ||
@@ -216,2 +233,4 @@ }) => string; | ||
type?: number; | ||
firstName?: string; | ||
lastName?: string; | ||
}) => string; | ||
@@ -223,3 +242,18 @@ macAddress: (options?: { | ||
}) => string; | ||
domainSuffix: (options?: { | ||
locale?: string; | ||
}) => string; | ||
domainName: (options?: { | ||
locale?: string; | ||
}) => string; | ||
email: (options?: { | ||
locale?: string; | ||
firstName?: string; | ||
lastName?: string; | ||
provider?: string; | ||
}) => string; | ||
domainUrl: (options?: { | ||
locale?: string; | ||
}) => string; | ||
}; | ||
export default _default; |
@@ -25,5 +25,9 @@ var __defProp = Object.defineProperty; | ||
cityPrefix: () => cityPrefix, | ||
citySufix: () => citySufix, | ||
citySuffix: () => citySuffix, | ||
color: () => color, | ||
default: () => src_default, | ||
domainName: () => domainName, | ||
domainSuffix: () => domainSuffix, | ||
domainUrl: () => domainUrl, | ||
email: () => email, | ||
firstName: () => firstName, | ||
@@ -153,6 +157,6 @@ imageUrlFromPlaceIMG: () => imageUrlFromPlaceIMG, | ||
}; | ||
var citySufix = (options = {}) => { | ||
var citySuffix = (options = {}) => { | ||
const { locale } = options; | ||
const citySufixes = getLocaleData({ locale, key: "citySufixes" }); | ||
return arrayElement(citySufixes); | ||
const citySuffixes = getLocaleData({ locale, key: "citySuffixes" }); | ||
return arrayElement(citySuffixes); | ||
}; | ||
@@ -259,10 +263,13 @@ var PlaceImgCategory; | ||
var username = (options = {}) => { | ||
const { locale, type } = options; | ||
switch (type || number({ max: 2 })) { | ||
const { locale, type: _type, firstName: _firstName, lastName: _lastName } = options; | ||
const newFirstName = _firstName || firstName({ locale }); | ||
const newLastName = _lastName || lastName({ locale }); | ||
const type = typeof _type !== "undefined" ? _type : number({ max: 2 }); | ||
switch (type) { | ||
case 0: | ||
return firstName({ locale }) + number({ max: 99 }); | ||
return newFirstName + number({ max: 99 }); | ||
case 1: | ||
return firstName({ locale }) + arrayElement([".", "_"]) + lastName({ locale }); | ||
return newFirstName + arrayElement([".", "_"]) + newLastName; | ||
case 2: | ||
return firstName({ locale }) + arrayElement([".", "_"]) + lastName({ locale }) + number({ max: 99 }); | ||
return newFirstName + arrayElement([".", "_"]) + newLastName + number({ max: 99 }); | ||
} | ||
@@ -315,2 +322,22 @@ }; | ||
}; | ||
var email = (options = {}) => { | ||
const { locale, provider: _provider } = options; | ||
const freeEmails = getLocaleData({ locale, key: "freeEmails" }); | ||
const provider = _provider || arrayElement(freeEmails); | ||
return `${username(options)}@${provider}`; | ||
}; | ||
var domainName = (options = {}) => { | ||
const { locale } = options; | ||
const name2 = arrayElement([ | ||
word({ locale, type: WordType.NOUN }), | ||
firstName({ locale }) | ||
]); | ||
return `${name2.toLowerCase()}.${domainSuffix({ locale })}`; | ||
}; | ||
var domainSuffix = (options = {}) => { | ||
const { locale } = options; | ||
const domainSuffixes = getLocaleData({ locale, key: "domainSuffixes" }); | ||
return arrayElement(domainSuffixes); | ||
}; | ||
var domainUrl = (options = {}) => `https://${domainName(options)}`; | ||
var src_default = { | ||
@@ -320,3 +347,3 @@ setDefaultLocale, | ||
cityName, | ||
citySufix, | ||
citySuffix, | ||
cityPrefix, | ||
@@ -345,3 +372,7 @@ number, | ||
username, | ||
macAddress | ||
macAddress, | ||
domainSuffix, | ||
domainName, | ||
email, | ||
domainUrl | ||
}; | ||
@@ -364,4 +395,8 @@ // Annotate the CommonJS export names for ESM import in node: | ||
cityPrefix, | ||
citySufix, | ||
citySuffix, | ||
color, | ||
domainName, | ||
domainSuffix, | ||
domainUrl, | ||
email, | ||
firstName, | ||
@@ -368,0 +403,0 @@ imageUrlFromPlaceIMG, |
@@ -38,5 +38,26 @@ var __create = Object.create; | ||
// src/locales/fr_CA/internet/domainSuffixes.ts | ||
var domainSuffixes_default = [ | ||
"qc.ca", | ||
"ca", | ||
"com", | ||
"biz", | ||
"info", | ||
"name", | ||
"net", | ||
"org" | ||
]; | ||
// src/locales/fr_CA/internet/freeEmails.ts | ||
var freeEmails_default = [ | ||
"gmail.com", | ||
"yahoo.ca", | ||
"hotmail.com" | ||
]; | ||
// src/locales/fr_CA/index.ts | ||
var locale = { | ||
phoneFormats: formats_default | ||
phoneFormats: formats_default, | ||
domainSuffixes: domainSuffixes_default, | ||
freeEmails: freeEmails_default | ||
}; | ||
@@ -43,0 +64,0 @@ import__.default.addLocale("fr_CA", locale); |
@@ -1291,2 +1291,20 @@ var __create = Object.create; | ||
// src/locales/fr/internet/domainSuffixes.ts | ||
var domainSuffixes_default = [ | ||
"com", | ||
"fr", | ||
"eu", | ||
"info", | ||
"name", | ||
"net", | ||
"org" | ||
]; | ||
// src/locales/fr/internet/freeEmails.ts | ||
var freeEmails_default = [ | ||
"gmail.com", | ||
"yahoo.fr", | ||
"hotmail.fr" | ||
]; | ||
// src/locales/fr/index.ts | ||
@@ -1300,3 +1318,5 @@ var locale = { | ||
lastNames: lastNames_default, | ||
...titles_default | ||
...titles_default, | ||
domainSuffixes: domainSuffixes_default, | ||
freeEmails: freeEmails_default | ||
}; | ||
@@ -1303,0 +1323,0 @@ import__.default.addLocale("fr", locale); |
{ | ||
"name": "minifaker", | ||
"version": "1.11.0", | ||
"version": "1.12.0", | ||
"description": "lightweight faker.js", | ||
@@ -25,3 +25,3 @@ "types": "./dist/index.d.ts", | ||
"devDependencies": { | ||
"@types/jest": "^27.0.2", | ||
"@types/jest": "^27.0.3", | ||
"esbuild": "^0.13.14", | ||
@@ -28,0 +28,0 @@ "jest": "^27.3.1", |
@@ -83,3 +83,3 @@ # minifaker | ||
cityPrefix|en|cityPrefix | ||
citySufix|en|citySufix | ||
citySuffix|en|citySufix | ||
imageUrl|n/a|imageUrlFromPlaceIMG | ||
@@ -103,1 +103,5 @@ imageUrl|n/a|imageUrlFromPlaceholder | ||
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 |
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
527884
38495
106