UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

25 lines (24 loc) 748 B
import { uniq, dropWhile } from 'ramda'; import composeC from './composeC'; /** * Returns a new unique list excluding the leading elements of a given list * which satisfy the supplied predicate function. * It passes each value to the supplied predicate function, skipping elements while the predicate function returns true. * * @func * @category List * * @param {function} fn The function called per iteration. * @param {array} xs The collection to iterate over. * * @return {array} New array * * @example * * R_.uniqDropWhile(x => x !== 4, [1, 2, 3, 4, 3, 2, 1, 1, 1]); //=> [4, 3, 2, 1] * * * @sig (a -> Boolean) -> [a] -> [a] */ var uniqDropWhile = /*#__PURE__*/composeC(uniq, dropWhile); export default uniqDropWhile;