
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
changes-feed-diff
Advanced tools
generate diffs of old documents to new in changes from a couch style changes feed
generate diffs of changes to documents from a couch style changes feeds
var doc1 = {seq:1,id:"alice",doc:{name:"alice",inc:1}}
var doc2 = {seq:2,id:"alice",doc:{name:"alice",inc:2}}
var makeDiffer = require('change-feed-diff')
var differ = makeDiffer({
dir:'./data'
})
differ(doc1,function(err,diff){
if(err) throw err
console.log('diff for doc 1:',diff)
differ(doc2,function(err,diff){
if(err) throw err
console.log('diff for doc 2:',diff)
})
})
this will print
diff for doc 1: []
diff for doc 2: [ { path: [ 'inc' ],
reason: 'values are not equal',
value: { a: 2, b: 1 },
code: 'VNEQUAL' } ]
this stores the previous version on disk inside the data directory. we keep a number of versions so if your process crashes and the database does compaction these are as consistent as they can be.
$ tree data
data
└── a
└── alice
├── 1-seq.json
└── 2-seq.json
2 directories, 2 files
you can run example.js to do this on the npm changes feed
/a/apple/_attachments/file instead of /a/apple/filecb(err,diff,previous document)
[
{
path:[array, of, keys, to, dereference, the, value],
reason:'a text reason',
values:{a:'new',b:'old'},
// the values compared to determine the result.
//in most cases this is not the value of the key but the values used to validate the assertion
code: a code that represents comparison type. listed below
}
]
if there are no changes, or no previous version the diff is an empty array []
these are string constants that represent kinds of changes. these are the kinds of changes that you will see. the reason string may change but this value will not without a major bump.
this only allows one concurrent diff per document id. this prevents a race condition where 2 versions of the same document are compared at the same time yeilding an incorrect diff for the later version.
FAQs
generate diffs of old documents to new in changes from a couch style changes feed
The npm package changes-feed-diff receives a total of 1 weekly downloads. As such, changes-feed-diff popularity was classified as not popular.
We found that changes-feed-diff 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.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.