
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
A tool to extract key-value pairs by comparing a template with an input string.
A tool to extract key-value pairs by comparing (diffing) a template with an input string.
npm install flowxo/diffex
diffex is initialised with a template, which is used as a base for the diffing.
A template is a simple string with {{placeholder}} values. These placeholders will be replaced with data when the template is applied to an input string.
You should define your template variables inside {{ and }} curly braces. Don't include any spaces inside the curlys, as this will prevent the extractor from working correctly.
For example, these template variables are ok:
{{name}}
{{first_name}}
{{last-name}}
whereas these are invalid:
{{ name }}
{{first name}}
{{ last name }}
Create the diffex object like so:
var do = diffex(template);
Once you have the diffex object, there are two methods available: placeholders() and parse(input).
.placeholders()Parses the template and outputs all found placeholders.
Example:
var diffex = require('diffex');
var template = '{{customer}} owes £{{amount}}.';
diffex(template).placeholders();
// -> ['customer', 'amount']
.parse(input)Compares the template with an input, extracting the differences and outputting as key-value pairs.
var diffex = require('diffex');
var template = '{{customer}} owes £{{amount}}.';
var input = 'Bob owes £19.'
diffex(template).parse(input);
// -> { customer: 'Bob', amount: '19' }
The core diff algorithm was implemented by Neil Fraser, originally found here. The library is reproduced here under the Apache 2.0 license.
Apache 2.0
FAQs
A tool to extract key-value pairs by comparing a template with an input string.
We found that diffex 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
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.