
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A tool that figures out what LoDash function you should use given an input, desired output, and predicate.

LoMatch is a tool that figures out what Lodash function you should use given an input, desired output, and predicate.
LoMatch isn't likely to live inside of a project, but more likely to be used a few times throughout a project in order to determine what Lodash functions to use. Because of this, I created an online tool to use LoMatch. You will almost always only need to use this tool and not need to install the npm module.
LoMatch is available as an npm module if you so choose to include it in your project. This is the easiest way to install it:
npm install lomatch
yarn add lomatch
const { LoMatch } = require('lomatch');
let results = LoMatch(input, output, primers);
console.log(results);
input - an object, array, or string that you currently have
output - the desired format you want your data in
primers - an array of values that you think will help LoMatch figure out a result
results - an array of objects containing a func and args that when in combination with your input can get you to your output
Examples below
I have a starting array of [1, 2, 3, 2, 2], and I want a final array of [1, 3]. I don't know which Lodash functions I need to use in order to get there, so I'll use LoMatch!
const { LoMatch } = require('lomatch');
LoMatch([1, 2, 3, 2, 2], [1, 3], []);
This will return an output of all the Lodash functions and predicate combinations you should use (only one 'smallest' predicate per function).
[ { func: '_.difference', args: [ 2 ] },
{ func: '_.differenceBy', args: [ 2 ] },
{ func: '_.differenceWith', args: [ 2 ] },
{ func: '_.intersection', args: [ 1, 3 ] },
{ func: '_.intersectionBy', args: [ 1, 3 ] },
{ func: '_.intersectionWith', args: [ 1, 3 ] },
{ func: '_.pull', args: 2 },
{ func: '_.pullAll', args: [ 2 ] },
{ func: '_.pullAllBy', args: [ 2 ] },
{ func: '_.pullAllWith', args: [ 2 ] },
{ func: '_.pullAt', args: [ 0, 2 ] },
{ func: '_.without', args: 2 },
{ func: '_.xor', args: [ 2 ] },
{ func: '_.xorBy', args: [ 2 ] },
{ func: '_.xorWith', args: [ 2 ] } ]
This means that you can use something like _.pull([1, 2, 3, 2, 2], 2) in order to get [1, 3]. LoMatch will return results for both modified arrays and returned arrays. Be sure to read the Lodash documentation for the function you are going to use.
I have a starting object of { 'a': [{ 'b': { 'c': 3 } }, 4] }, and I want a final array of [3, 4].
const { LoMatch } = require('lomatch');
LoMatch({ 'a': [{ 'b': { 'c': 3 } }, 4] }, [3, 4], []);
This will return an output of all the Lodash functions and predicate combinations you should use.
[ { func: '_.at', args: [ 'a[0].b.c', 'a[1]' ] } ]
This means that you can use _.at({ 'a': [{ 'b': { 'c': 3 } }, 4] }, [ 'a[0].b.c', 'a[1]' ]) in order to get [3, 4]. LoMatch will return results for both modified objects and returned objects. Be sure to read the Lodash documentation for the function you are going to use.
While strings are supported by LoMatch, there will only in rare cases be more than one solution.
I have a starting string of 'fred, barney, & pebbles', and I want a final array of ['fred', 'barney', 'pebbles'].
const { LoMatch } = require('lomatch');
LoMatch('fred, barney, & pebbles', ['fred', 'barney', 'pebbles'], []);
This will return an output of all the Lodash functions and predicate combinations you should use.
[ { func: '_.words', args: [] } ]
This means that you can use _.words('fred, barney, & pebbles') in order to get ['fred', 'barney', 'pebbles']. Keep in mind strings are primitives and thus cannot be mutated in JavaScript. Be sure to read the Lodash documentation for the function you are going to use.
FAQs
A tool that figures out what LoDash function you should use given an input, desired output, and predicate.
We found that lomatch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.