New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

wtdiff

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wtdiff

Spanned from a problem I had at work while dealing with deciding what to send as part of the payload.

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

WTDiff!

Spanned from a problem I had at work while dealing with deciding what to send as part of the payload.

Rule of thumb from experience, just send what's necessary to make the update.

Why?

KISS - Keep it simple and stupid

  • We need to keep changes predictable
  • Our consuming source does not need to know about what has not changed
  • The consuming source should simply run the updates based on all the fields sent

Let's get to it

CommonJS

const wtdiff = require("wtdiff")

const dude1 = {name: "dude", job: "guitar player"}
const dude2 = {name: "dude", job: "developer"}

cosnt changes = wtdiff.extractChanges(dude1, dude2)

console.log(changes)
/**
  {
    job: "developer"
  }
*/

ES Modules

import wtdiff from 'wtdiff'

const dude1 = {name: "dude", job: "guitar player"}
const dude2 = {name: "dude", job: "developer"}

cosnt changes = wtdiff.extractChanges(dude1, dude2)

console.log(changes)
/**
  {
    job: "developer"
  }
*/

Supporting

  • Nested objects
  • [] Nested arrays

Keywords

updates

FAQs

Package last updated on 05 Apr 2022

Did you know?

Socket

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.

Install

Related posts