本文整理汇总了TypeScript中faker.address.city方法的典型用法代码示例。如果您正苦于以下问题:TypeScript address.city方法的具体用法?TypeScript address.city怎么用?TypeScript address.city使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类faker.address
的用法示例。
在下文中一共展示了address.city方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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(),
};
}
示例3: reducer
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));
}
case CalendarActionTypes.BeginDragNewEvent: {
return state.set('inFlight',
CalendarEvent.allDay(`Conference in ${faker.address.city()}`, action.start, action.start)
.set('temp', true));
}
case CalendarActionTypes.HoverNewEvent: {
// if (state.inFlight && state.inFlight.end === action.end) { return state; }
return state.update('inFlight', f => f.set('end', action.end));
}
case CalendarActionTypes.EndDragNewEvent: {
return state.set('inFlight', null);
}
case CalendarActionTypes.ResetCalendar: {
return new CalendarStateRecord();
}
case CalendarActionTypes.DropNewEvent: {
if (state.inFlight) {
const inFlight = state.inFlight
.set('end', action.end)
.set('temp', false);
state = state.update('events', evs => evs.push(inFlight));
}
state = state.set('inFlight', null);
return state;
}
case CalendarActionTypes.PrevMonth: {
return state.set('startDate', state.startDate.clone().add({months: -1}).startOf('month'));
}
case CalendarActionTypes.NextMonth: {
return state.set('startDate', state.startDate.clone().add({months: 1}).startOf('month'));
}
case CalendarActionTypes.BeginDragExistingEvent: {
return state
.set('original', state.events.find(e => e.uniqueId === action.id));
}
case CalendarActionTypes.EndDragExistingEvent: {
return state.set('original', null).set('diff', new Diff());
}
case CalendarActionTypes.HoverResizeStart: {
return state.update('diff', d => d.set('start', action.diff));
}
case CalendarActionTypes.HoverResizeEnd: {
return state.update('diff', d => d.set('end', action.diff));
}
case CalendarActionTypes.HoverExistingEvent: {
return state.update('diff', d => d.set('distance', action.diff));
}
case CalendarActionTypes.DropExistingEvent: {
if (!state.original) {
return state;
}
return state.update('events', es => {
const idx = es.findIndex(e => e.uniqueId === action.id);
return es.update(idx, e => e.applyDiff(state.diff));
}).set('original', null).set('diff', new Diff());
}
default:
return state;
}
}