diff --git a/src/utils/common.js b/src/utils/common.js index 798d0e43..dbc8b546 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -41,4 +41,14 @@ export function indexEquals(withNumber) { */ export function select(byCondition, map = i => i) { return (result, item) => byCondition(item) ? map(item): map(result) +} + +/** + * Select an item in Array by specified selector function + * @param scope + * @param selector + * @returns {*} + */ +export function choise(scope, selector){ + return scope.reduce(selector, null); } \ No newline at end of file