本文整理汇总了TypeScript中faker.name.findName方法的典型用法代码示例。如果您正苦于以下问题:TypeScript name.findName方法的具体用法?TypeScript name.findName怎么用?TypeScript name.findName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类faker.name
的用法示例。
在下文中一共展示了name.findName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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()
};
})
示例2: createItem
function createItem() {
return {
name: faker.name.findName(),
phone: faker.phone.phoneNumber(),
country: faker.address.country()
};
}
示例3: createArray
const persons = createArray(numberOfPersons, i => {
return [
i,
faker.name.findName(),
faker.address.streetAddress(),
faker.phone.phoneNumber(),
faker.date.past(),
]
})
示例4: 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();
}
}
示例5: getFakerData
/**
* Use faker to generate metadata for the inputs
* @param {type}
* the type of input to generate metadata for
*/
getFakerData(type): any {
switch (type) {
case 'string':
return faker.lorem.sentence();
case 'boolean':
return Math.random() > 0.5;
case 'sentence':
return faker.lorem.sentence();
case 'image':
let width = Math.floor(Math.random() * (500 - 300 + 1) + 300);
let height = Math.floor(Math.random() * (300 - 250 + 1) + 300);
return faker.image.imageUrl(width, height);
case 'avatar':
return faker.image.avatar();
case 'words':
return faker.lorem.words();
case 'phone':
return faker.phone.phoneNumber();
case 'name':
return faker.name.findName();
default:
return null;
}
}
示例6:
filter: string;
order: TNGOR_SORT;
sort: 'id' | 'name' | 'birthdate';
}
interface IUserDto {
id: number;
name: string;
birthdate: string;
}
const users: IUserDto[] = [
{
birthdate: faker.date.past().toISOString(),
id: 1,
name: faker.name.findName(),
},
{
birthdate: faker.date.past().toISOString(),
id: 2,
name: faker.name.findName(),
},
{
birthdate: faker.date.past().toISOString(),
id: 3,
name: faker.name.findName(),
},
{
birthdate: faker.date.past().toISOString(),
id: 4,
name: faker.name.findName(),
示例8: moment
import * as moment from 'moment-mini-ts';
import * as faker from 'faker';
export interface CalendarState {
events: List<CalendarEvent>;
startDate: moment.Moment,
inFlight: CalendarEvent | null;
original: CalendarEvent | null;
diff: Diff;
}
const dayOne = moment().startOf('month');
export const CalendarStateRecord = Record({
events: List([
CalendarEvent.standard(`Meeting with ${faker.name.findName()}`, dayOne.clone().add({ days: 3, hours: 13 }).toDate()),
CalendarEvent.allDay("Conference in Berlin", dayOne.clone().add({ days: 7 }).toDate(), dayOne.clone().add({ days: 11 }).toDate()),
]),
startDate: dayOne,
inFlight: null as CalendarEvent,
original: null as CalendarEvent,
diff: new Diff()
});
export function reducer(state = new CalendarStateRecord(), action: CalendarActions): CalendarState {
// console.log(action);
switch (action.type) {
case CalendarActionTypes.NewEvent: {
return state.update('events', es => es.push(action.event));
}