ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
26 lines (25 loc) • 511 B
JavaScript
import { map, uniq } from 'ramda';
import composeC from './composeC';
/**
* Returns unique values previously returned by mapping.
*
* @func
* @category List
*
* @param {Function} fn mapping function
* @param {array} xs Data
*
* @return {array} Unique array of values
*
* @example
*
* R_.uniqMap(R_.equalsLength(5))([
* "hello",
* "hello",
* "world"
* ]) // ["hello", "world"]
*
* @sig (a -> a) -> [a] -> [a]
*/
var uniqMap = /*#__PURE__*/composeC(uniq, map);
export default uniqMap;