UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

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