javascript - How do I mix underscore functions to use a custom comparison algorithm for _.contains()? -
Ideally, I want to pass a custom comparison function to Code I want to do this: ... but if I can not, what's the best thing? It looks as if you are looking, what if You can easily wrap it in your function: _. Logic, but it only accepts collection and one value.
_.contains (['apple', 'orange'], ' Sepales', function (element, value) {new rexpacks (element) test (value);});
true returns Passes at least one element in the test array:
_. Some (['apple' '' oranges'], function (element) {new replay (element) test ('selection');});
function test_regexes (arr, value) {return_.some (arr, function) {New RegExp (element) .test (value);}); } test_regexes (['apple', 'orange'], 'sepalesh');
Comments
Post a Comment