
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
difflet-papandreou
Advanced tools
Create colorful diffs for javascript objects.
var difflet = require('difflet');
var s = difflet.compare({ a : 2, c : 5 }, { a : 3, b : 4 });
process.stdout.write(s);
output:

var diff = require('difflet')({ indent : 2 });
var prev = {
yy : 6,
zz : 5,
a : [1,2,3],
fn : 'beep',
c : { x : 7, z : 3 }
};
var next = {
a : [ 1, 2, "z", /beep/, new Buffer(3) ],
fn : function qqq () {},
b : [5,6,7],
c : { x : 8, y : 5 }
};
diff(prev, next).pipe(process.stdout);
output:

green for inserts, blue for updates, red for deletes
var difflet = require('difflet')
Create a difflet from optional options opts.
With opts.start(type, stream) and opts.stop(type, stream),
you can write custom handlers for all the types of differences:
'inserted', 'updated', and 'deleted'.
By default green is used for insertions, blue for updates, and red for
deletions.
If opts.indent is set, output will span multiple lines and opts.indent
spaces will be used for leading whitespace.
If opts.comma === 'first' then commas will be placed at the start of lines.
Setting opts.comment to true will turn on comments with the previous
contents like this:

Return a stream with the colorful changes between objects prev and next.
Return a string with the colorful changes between prev and next.
Return a string with the colorful changes between prev and next with the
default options.
With npm do:
npm install difflet
With npm do:
npm test
MIT/X11
FAQs
colorful diffs for javascript objects
We found that difflet-papandreou 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.