Skip to content

Commit

Permalink
add matchAnyWord/makeAndTest/makeRegex
Browse files Browse the repository at this point in the history
add matchAnyWord and utility functions makeAndTest/makeRegex
  • Loading branch information
kmachado committed Mar 24, 2017
1 parent 663b90d commit b17810f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ export const deepMap = _.curry((fn, obj, _map = map, is = isTraversable) =>
// Misc
// ----
export const testRegex = regex => regex.test.bind(regex)
export const makeRegex = options => text => RegExp(text, options)
export const makeAndTest = options => _.flow(makeRegex(options), testRegex)
export const matchAnyWord = _.flow(
_.words,
_.map(makeAndTest('gi')),
_.overSome
)

0 comments on commit b17810f

Please sign in to comment.