UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

24 lines (23 loc) 734 B
import { useWith, flip, test, identity, concat } from 'ramda'; import constructRegExp from './constructRegExp'; var getRegExp_ = /*#__PURE__*/useWith( /*#__PURE__*/flip(constructRegExp)('gi'), [/*#__PURE__*/flip(concat)('$')]); /** * Testing string if ends with some suffix. * * @func * @category String * * @param {string} suffix * @param {string} x * @return {boolean} True if `x` ends with `suffix` * * @example * * R_.endsWithSuffix('o', 'hello') // true * R_.endsWithSuffix('ello', 'hello') // true * R_.endsWithSuffix('y', 'good bye') // false * * @sig a -> b -> Boolean */ var endsWithSuffix = /*#__PURE__*/useWith(test, [getRegExp_, identity]); export default endsWithSuffix;