import curry from 'lodash/curry';
const match = curry(function(what, str) {
return str.match(what);
});
match(/\s+/g, 'hello world');
// [ ' ' ]
match(/\s+/g)('hello world');
// [ ' ' ]
const hasSpaces = match(/\s+/g); // Point free
hasSpaces('hello world');
// [ ' ' ]
hasSpaces('spaceless');
// null
import { flow, map, filter, prop, toUpper } from 'lodash/fp';
const users = [
{ name: 'a', isActive: false },
{ name: 'b', isActive: true },
];
const getUpperName = flow(prop('name'), toUpper);
const getActiveUsers = filter(prop('isActive'));
flow(getActiveUsers, getUpperName)(users)
// ['A', 'B']