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


TypeScript List.map方法代码示例

本文整理汇总了TypeScript中Immutable.List.map方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.map方法的具体用法?TypeScript List.map怎么用?TypeScript List.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Immutable.List的用法示例。


在下文中一共展示了List.map方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getStageNameList

function getStageNameList(stageList: List<StageConfig | RawStageConfig>) {
  if (stageList.isEmpty()) {
    return 'empty'
  } else {
    return stageList.map(s => s.name).join(',')
  }
}
开发者ID:socoolxin,项目名称:battle-city,代码行数:7,代码来源:syncLocalStorage.ts

示例2: todosReducer

function todosReducer(state:List<ITask>, action:IAction):List<ITask> {
        console.log(`todosReducer: Action(${JSON.stringify(action)})`);
        switch(action.type) {
                case Keys.AddTodo:
                    var todos: List<ITask> = List<ITask>(state.concat([action.payload]));
                    console.log(`todosReducer: todos(${JSON.stringify(todos)})`);
                    return todos;
                case Keys.CompleteTodo:
                        return List<ITask>(state.map((task:ITask) => {
                                if (task.Id === action.payload.Id) {
                                        return new Task(
                                                task.Id,
                                                task.Title,
                                                task.Description,
                                                action.payload.Complete
                                        );
                                } else {
                                        return task;
                                }
                        }));
                case Keys.RemoveTodo:
                        return List<ITask>(state.filter((task:ITask) => {
                                return task.Id !== action.payload.Id;
                        }))
        }                                 
        return state || initialState.todos;
}
开发者ID:darcy-buttrose,项目名称:react-redux-jest-webapi,代码行数:27,代码来源:Reducer.ts

示例3: totalIncomeForeignAmount

 totalIncomeForeignAmount(): BigNumber {
   return this.incomes
       .map((i: Income) => i.foreignAmount)
       .reduce(
           (a: BigNumber, b: BigNumber) => a.plus(b),
           new BigNumber(0));
 }
开发者ID:gaborfeher,项目名称:grantmaster,代码行数:7,代码来源:Project.ts

示例4: recomputeRemaining

 recomputeRemaining(): Project {
   let remaining: BigNumber = this.incomes
       .map(
           (i: Income) => i.remainingLocalAmount())
       .reduce(
           (a: BigNumber, b: BigNumber) => a.plus(b),
           new BigNumber(0));
   return this.set('remainingLocalAmount', remaining);
 }
开发者ID:gaborfeher,项目名称:grantmaster,代码行数:9,代码来源:Project.ts

示例5: todosReducer

function todosReducer(state: List<Todo> = List([]), action) {
  switch (action.type) {
    case LOAD_TODOS:
      return List(action.todos);
    case ADD_TODO:
      return state.push(action.newTodo);
    case TOGGLE_TODO:
      return toggleTodo(state, action);
    case TOGGLE_ALL_TODO:
      return toggleAllTodo(state, action.completed);
    case DELETE_TODO:
      let index = state.findIndex((todo) => todo.id === action.todo.id);
      return state.delete(index);
    case SET_CURRENT_FILTER:
      return state.map(todo => todo);
    case '@@redux-pouchdb-plus/SET_REDUCER':
      return state.map(todo => new Todo(todo.toJS()));
    default:
      return state;
  }
}
开发者ID:tedliang,项目名称:angular2-redux-starter,代码行数:21,代码来源:todo.ts

示例6: calcMinMoves

 private calcMinMoves() {
   this.consoleLogMsg('score.service', 'calcMinMoves');
   let moves: number = 0;
   if (this._data.size > 0) {
     this._data.map((score: Score) => {
       if (moves === 0 || score.moves < moves) {
         moves = score.moves;
       }
     });
   }
   this._minMoves = moves;
 }
开发者ID:bradyhouse,项目名称:house,代码行数:12,代码来源:score.service.ts

示例7: calcNextRow

 private calcNextRow() {
   this.consoleLogMsg('score.service', 'calcNextRow');
   let row: number = 1;
   if (this._data.size > 0) {
     this._data.map((score: Score) => {
       if (score.row > row) {
         row = score.row;
       }
     });
     row++;
   }
   this.nextRow = row;
   this.consoleLogMsg('score.service', 'nextRow = ' + this.nextRow);
 }
开发者ID:bradyhouse,项目名称:house,代码行数:14,代码来源:score.service.ts

示例8: calcNextId

 private calcNextId() {
   this.consoleLogMsg('score.service', 'calcNextId');
   let id: number = 1;
   if (this._data.size > 0) {
     this._data.map((score: Score) => {
       if (score.id > id) {
         id = score.id;
       }
     });
     id++;
   }
   this._nextId = id;
   this.consoleLogMsg('score.service', 'nextId = ' + this.nextId);
 }
开发者ID:bradyhouse,项目名称:house,代码行数:14,代码来源:score.service.ts

示例9: forkJoin

const fetchMapIssues = (reposIds: List<string>, state: any, page: number) =>
  forkJoin(
    ...reposIds
      .map(id =>
        get({
          endpoint: `repos/${state.repository.getIn([id, "full_name"])}/issues`,
          params: { page }
        })
      )
      .toArray()
  ).pipe(
    map(issues => {
      return List(issues)
        .map((issueArr: any, index) => {
          return issueArr.map(issue =>
            issue.set("repositoryId", reposIds.get(index))
          );
        })
        .flatten(1);
    })
  );
开发者ID:alex3165,项目名称:github-issues,代码行数:21,代码来源:issues.ts

示例10: todosReducer

function todosReducer(state:List<ITask>, action:IAction):List<ITask> {
        switch(action.key) {
                case Keys.AddTodo:
                        return List<ITask>(state.concat([action.payload]))
                case Keys.CompleteTodo:
                        return List<ITask>(state.map((task:ITask) => {
                                if (task.Id === action.payload.Id) {
                                        return new Task(
                                                task.Id,
                                                task.Title,
                                                task.Description,
                                                action.payload.Complete
                                        );
                                } else {
                                        return task;
                                }
                        }));
                case Keys.RemoveTodo:
                        return List<ITask>(state.filter((task:ITask) => {
                                return task.Id !== action.payload.Id;
                        }))
        }                                 
        return state;
}
开发者ID:darcy-buttrose,项目名称:react-redux-bootstrap-todo,代码行数:24,代码来源:Reducer.ts


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