當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。