From 40842b1ed27536909201511b9894f95335ec0da3 Mon Sep 17 00:00:00 2001 From: kmachao Date: Thu, 30 Mar 2017 17:36:47 -0400 Subject: [PATCH] fix testRegex --- CHANGELOG.md | 3 +++ package.json | 2 +- src/regex.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da679534..dec7bb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.10.1 +- Fix `testRegex` + # 1.10.0 - Add `matchAllWords` diff --git a/package.json b/package.json index d3fb21c1..deb94aa1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "futil-js", - "version": "1.10.0", + "version": "1.10.1", "description": "F(unctional) util(ities). Resistance is futile.", "main": "lib/futil-js.js", "scripts": { diff --git a/src/regex.js b/src/regex.js index c23be171..0825a1bb 100644 --- a/src/regex.js +++ b/src/regex.js @@ -1,7 +1,7 @@ import _ from 'lodash/fp' import {push, insertAtIndex, mergeRanges} from './array' -export const testRegex = regex => regex.test.bind(regex) +export const testRegex = _.curry((regex, str) => (new RegExp(regex)).test(str)) export const makeRegex = options => text => RegExp(text, options) export const makeAndTest = options => _.flow(makeRegex(options), testRegex) export const matchAnyWord = _.flow(