ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
23 lines (22 loc) • 517 B
JavaScript
import { uniq, dropLast } from 'ramda';
import composeC from './composeC';
/**
* Returns all unique but the last n elements of the given list,
* or transducer/transformer (or object with a drop method).
*
* @func
* @category List
*
* @param {number} n
* @param {Array} xs Collection
*
* @return {Array}
*
* @example
*
* R_.uniqDropLast(2, ["bar", "foo", "foo"]) // ["foo"]
*
* @sig Number -> [a] -> [a]
*/
var uniqDropLast = /*#__PURE__*/composeC(uniq, dropLast);
export default uniqDropLast;