当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript address.city方法代码示例

本文整理汇总了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(),
   };
 }
开发者ID:Rigg802,项目名称:SampleApp,代码行数:18,代码来源:faker.ts

示例2:

 city: () => faker.address.city(),
开发者ID:codeaudit,项目名称:graphql-faker,代码行数:1,代码来源:fake.ts

示例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;
  }
}
开发者ID:fossabot,项目名称:angular-skyhook,代码行数:78,代码来源:calendar.reducer.ts


注:本文中的faker.address.city方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。