update-data
Simple data comparsion and composition library
Install
# npm npm i update-data # yarn yarn add update-data
Usage
updateList
Updates array with a new array by match, and compete functions between records
;
Example
; ; console.log updateList docs, update,docNew.id === docOld.id,docNew.updated.getTime > docOld.updated.getTime, ,;
Result
id: '1' title: 'Document 1' status: 'upd' // <--- New value updated: '1970-01-01T00:00:03.000Z' // <--- New value id: '2' title: 'Document 2' status: 'old' updated: '1970-01-01T00:00:02.000Z' // New record id: '3' title: 'Document 3' status: 'new' updated: '1970-01-01T00:00:04.000Z' ;