Socket
Socket
Sign inDemoInstall

discrepances

Package Overview
Dependencies
Maintainers
6
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discrepances

show discrepances in several flavors


Version published
Weekly downloads
33
decreased by-32.65%
Maintainers
6
Weekly downloads
 
Created
Source

discrepances

Shows differences between different values

Use

var discrepances = require('discrepances');

var a={x:1, y:2, z:[3], d:4,  e:[{j:3, k:4, m:['a', 'b']}]};
var b={x:1, y:2, z:[3], d:44, e:[{j:3, k:4, m:['a']     }]};

var detectedDiscrepances = discrepances.nestedObject(a,b)
if(detectedDiscrepances){
    console.dir(detectedDiscrepances, {depth:9});
}
/*
{
  object:{
    d:{ difference: -40, values: [ 4, 44 ] },
    e:{
      array:{
        '0':{
          object:{
            m:{
              array:{ length:{ difference: 1, values: [ 2, 1 ] } }
            }
          }
        }
      }
    }
  }
}
*/
var detectedDiscrepances = discrepances.flatten(a,b)
if(detectedDiscrepances){
    console.log(detectedDiscrepances);
}
/*
{
  '.d': { difference: -40, values: [ 4, 44 ] },
  '.e[0].m[length]': { difference: 1, values: [ 2, 1 ] }
}
*/

API

discrepances.nestedObject(a,b[, opts])

(see spanish)

discrepances.flatten(a,b[, opts])

(see spanish)

discrepances.showAndThrow(a, b[, opts])

(see spanish)

var discrepances = require('discrepances');

var a={x:1, y:2, z:[3], d:4,  e:[{j:3, k:4, m:['a', 'b']}]};
var b={x:1, y:2, z:[3], d:44, e:[{j:3, k:4, m:['a']     }]};

it("compares a with b", function(){
    discrepances.showAndThrow(a,b,{context:'this message'})
});

Install

$ npm install discrepances

extending npm-version downloads build coverage climate dependencies qa-control

language: English also available in: Spanish

License

MIT

FAQs

Package last updated on 25 Mar 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc