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


TypeScript ramda.propEq函数代码示例

本文整理汇总了TypeScript中ramda.propEq函数的典型用法代码示例。如果您正苦于以下问题:TypeScript propEq函数的具体用法?TypeScript propEq怎么用?TypeScript propEq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: switch

export const companyReducer: ActionReducer<any> = (state: CompanyState = INITIAL_STATE, action: Action) => {
	switch (action.type) {
		case CompanyAction.CHILD_ADDED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: [...state.entities, process(action.payload)]
			});

		case CompanyAction.CHILD_CHANGED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: [...R.reject(R.propEq('$key', action.payload.$key))(state.entities),
				process(action.payload)]
			});

		case CompanyAction.CHILD_REMOVED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: R.reject(R.propEq('$key', action.payload.$key))(state.entities)
			});

		case CompanyAction.LOAD:
			return Object.assign({ }, state, {
				entities: undefined,
			});

		case CompanyAction.SELECT:
			return Object.assign({ }, state, {
				selected: action.payload
			});

		default:
		  return state;
	}
}
开发者ID:simbiosis-group,项目名称:ion2-contact,代码行数:35,代码来源:company.reducer.ts

示例2: matchesToMigration

function matchesToMigration(directory: string, matches: RegExpMatchArray[]): Migration {
  if (matches.length === 1) {
    let match = matches[0];

    // Single match is a split migration file.
    if (match[3]) throw new SplitFileMissingError(match[0]);

    return {
      id: match[1],
      name: match[2],
      split: false,
      path: path.join(directory, match[0])
    };
  } else if (matches.length === 2) {
    let upMatch = R.find(R.propEq(3, 'up'), matches);
    let downMatch = R.find(R.propEq(3, 'down'), matches);

    if (!upMatch) throw new SplitFileMissingError(downMatch[0]);
    if (!downMatch) throw new SplitFileMissingError(upMatch[0]);

    return {
      id: upMatch[1],
      name: upMatch[2],
      split: true,
      upPath: path.join(directory, upMatch[0]),
      downPath: path.join(directory, downMatch[0])
    };
  } else {
    // Too many matches.
    throw new SplitFileConflictError(R.map(m => m[0], matches));
  }
}
开发者ID:programble,项目名称:careen,代码行数:32,代码来源:files.ts

示例3: getUrls

function* getUrls(ids: Array<string>): SagaIterator {
  try {
    const bookmarkInfos: Array<BookmarkInfo> = yield all(ids.map((id) => call(getBookmarkInfo, id)))

    const filteredBookmarkInfos = bookmarkInfos.filter(
      R.both(R.propEq('isSimulated', false), R.propEq('type', BOOKMARK_TYPES.BOOKMARK))
    )
    return R.pluck('url', filteredBookmarkInfos)
  } catch (err) {
    console.error(err)

    return []
  }
}
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:14,代码来源:openBookmarksInBrowser.ts

示例4: getUser

		.map(([claim, users]) => {
			if (claim.approver) {
				const getUser = R.find(R.propEq('$key', claim.approver));
				return Object.assign(claim, { $approver: getUser(users) })
			}

			return claim;
		})
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:8,代码来源:claim.model.ts

示例5: searchKeywordMatcher

 (result: Array<BookmarkInfo>) => {
   const filteredResult = result.filter(R.propEq('type', CST.BOOKMARK_TYPES.BOOKMARK))
   if (isSearchTitleOnly) {
     return filteredResult.filter((bookmarkInfo: BookmarkInfo) => {
       return searchKeywordMatcher(payload.searchKeyword, bookmarkInfo.title)
     })
   }
   return filteredResult
 }
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:9,代码来源:getSearchResult.ts

示例6: updateLastPosition

function* updateLastPosition({
  payload
}: ActionType<typeof lastPositionsCreator.updateLastPosition>): SagaIterator {
  try {
    const {lastPositions = []}: LocalStorage = yield call(getLocalStorage)

    const index = lastPositions.findIndex(R.propEq('id', payload.id))
    if (index >= 0) {
      const updatedLastPositions = R.update(index, payload, lastPositions)

      yield call(setLocalStorage, {
        lastPositions: updatedLastPositions
      })
    }
  } catch (err) {
    console.error(err)
  }
}
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:18,代码来源:saga.ts

示例7:

 (player: Controller, minions: MinionContainer): MinionContainer =>
   R.filter(R.propEq('owner', player), minions)
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:2,代码来源:Minion.ts

示例8: function

const getPaymentReminders = function(priority, subject) {
  return fakeApi()
    .then(R.filter(R.propEq('priority', priority)))
    .then(R.filter(R.where({ subject: R.contains(subject)})))
    .then(R.sortBy(R.prop('from')));
}
开发者ID:marley-js,项目名称:Mastering-TypeScript-Programming-Techniques,代码行数:6,代码来源:api-ramda.ts

示例9: filterUserData

 function filterUserData(username) {
     return R.filter(R.propEq('username', username));
 }
开发者ID:dhassaine-scottlogic,项目名称:fp_experiments,代码行数:3,代码来源:ts_ramda.test.ts

示例10:

 connectables.map((s) => s.filter(propEq('type', 'ready')));
开发者ID:d6u,项目名称:dev-runner,代码行数:1,代码来源:utils.ts


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