本文整理汇总了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;
}
}
示例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));
}
}
示例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 []
}
}
示例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;
})
示例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
}
示例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)
}
}
示例7:
(player: Controller, minions: MinionContainer): MinionContainer =>
R.filter(R.propEq('owner', player), minions)
示例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')));
}
示例9: filterUserData
function filterUserData(username) {
return R.filter(R.propEq('username', username));
}
示例10:
connectables.map((s) => s.filter(propEq('type', 'ready')));