本文整理汇总了TypeScript中faker.name类的典型用法代码示例。如果您正苦于以下问题:TypeScript name类的具体用法?TypeScript name怎么用?TypeScript name使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了name类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getRandomPerson
export function getRandomPerson(options: GetRandomPersonOptions) {
const opts: GetRandomPersonOptions = options || {};
opts.maxDateOfBirth = opts.maxDateOfBirth || new Date(Date.now() - MS_IN_YEAR);
opts.minAge = opts.minAge || 18;
opts.maxAge = opts.maxAge || 105;
opts.depth = opts.depth || 0;
// Generates a family tree...of sorts
const result: Person = {
name: faker.name.lastName() + faker.name.firstName(),
employment: {
companyName: faker.company.companyName()
},
regex: /a/g,
age: faker.random.number(),
dateOfBirth: faker.date.past(),
enrolledToVote: faker.random.boolean(),
};
if (opts.depth > 0) {
result.parents = [
getRandomPerson({ depth: opts.depth - 1 }),
getRandomPerson({ depth: opts.depth - 1 })
];
}
return result;
}
开发者ID:codeandcats,项目名称:fast-clone,代码行数:29,代码来源:dataHelper.ts
示例2: times
data: times(3, (index) => {
return {
'id' : index + +offset + 1,
'firstname': faker.name.findName().split(' ')[0],
'lastname': faker.name.findName().split(' ')[0],
'email': faker.internet.email()
};
})
开发者ID:syafiqrokman,项目名称:angular5-iot-dashboard,代码行数:8,代码来源:mocks.service.ts
示例3:
const createMessage = (channelId) => {
return {
id: faker.random.uuid(),
content: faker.lorem.sentence(),
creationTime: faker.date.past().getTime().toString(),
author: {
name: faker.name.firstName() + '.' + faker.name.lastName(),
avatar: faker.image.avatar(),
},
channel: { id: channelId },
};
};
开发者ID:RocketChat,项目名称:Rocket.Chat.PWA,代码行数:12,代码来源:mocks.ts
示例4: getBaseName
function getBaseName(isMale: boolean): string {
const gender = getMaleNumber(isMale);
const random = faker.random.number(3);
switch (random) {
default: case 0: return faker.name.firstName(gender);
case 1: return faker.name.lastName(gender);
case 2:
const firstName = faker.name.firstName(gender);
const lastName = faker.name.lastName(gender);
const name = firstName + lastName;
return name.length > characterConfig.MAX_NAME_LENGTH ? firstName : name;
}
}
开发者ID:Tzook,项目名称:lul,代码行数:13,代码来源:randomNames.ts
示例5: createItem
function createItem() {
return {
name: faker.name.findName(),
phone: faker.phone.phoneNumber(),
country: faker.address.country()
};
}
开发者ID:aurelia,项目名称:aurelia,代码行数:7,代码来源:app.ts
示例6: createFakeRowObjectData
createFakeRowObjectData(index: number): Object {
return {
id: index,
avartar: faker.image.avatar(),
city: faker.address.city(),
email: faker.internet.email(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
street: faker.address.streetName(),
zipCode: faker.address.zipCode(),
date: faker.date.past(),
bs: faker.company.bs(),
catchPhrase: faker.company.catchPhrase(),
companyName: faker.company.companyName(),
words: faker.lorem.words(),
sentence: faker.lorem.sentence(),
};
}
开发者ID:Rigg802,项目名称:SampleApp,代码行数:18,代码来源:faker.ts
示例7: createArray
const persons = createArray(numberOfPersons, i => {
return [
i,
faker.name.findName(),
faker.address.streetAddress(),
faker.phone.phoneNumber(),
faker.date.past(),
]
})
开发者ID:jakobrun,项目名称:gandalf,代码行数:9,代码来源:generatePgData.ts
示例8: function
const getRandomPeople = function(count: number) : Person[] {
const people = [];
for (let ctr=0; ctr<count;ctr++) {
people.push({
name: faker.name.firstName(),
height: faker.random.number({min: 40, max: 88})
});
}
return people;
};
开发者ID:ctarrington,项目名称:JavaScriptSamples,代码行数:11,代码来源:util.ts
示例9: generatePeople
export function generatePeople(): Array<PersonModel> {
var personList: Array<PersonModel> = [];
for (var i = 0; i < NUM_PEOPLE; i++) {
var fname = faker.name.firstName(1);
var lname = faker.name.lastName(1);
var created = faker.date.recent(3).toDateString();
let p = new PersonModel();
p.firstname = fname;
p.lastname = lname;
p.CreatedAt = created;
Database.insert(p).then(id => {
console.log("insert success", id);
p.ID = id;
}, error => {
console.log("insert error", error);
});
personList.push(p);
}
return personList;
}
开发者ID:zaoky,项目名称:SqliteSample,代码行数:21,代码来源:fake-data-service.ts
示例10: switch
function getSanitizedValue<D>(
defaultValue: D,
sanitizeConfig?: SanitizeConfig
) {
if (!sanitizeConfig) return defaultValue;
switch (sanitizeConfig) {
case 'name':
return faker.name.findName();
case 'email':
return faker.internet.email();
case 'lorem':
return faker.lorem.sentences();
default:
return faker.lorem.text();
}
}
开发者ID:tyranid-org,项目名称:tyranid,代码行数:16,代码来源:sanitize.ts
注:本文中的faker.name类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论