Socket
Socket
Sign inDemoInstall

chai

Package Overview
Dependencies
6
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-rc.0 to 5.0.0

3

lib/chai/assertion.js

@@ -43,2 +43,4 @@ /*!

*
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
*
* @param {Mixed} obj target of the assertion

@@ -56,2 +58,3 @@ * @param {String} msg (optional) custom error message

util.flag(this, 'message', msg);
util.flag(this, 'eql', config.deepEqual ?? util.eql);

@@ -58,0 +61,0 @@ return util.proxify(this);

@@ -93,3 +93,29 @@ export const config = {

proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON']
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'],
/**
* ### config.deepEqual
*
* User configurable property, defines which a custom function to use for deepEqual
* comparisons.
* By default, the function used is the one from the `deep-eql` package without custom comparator.
*
* // use a custom comparator
* chai.config.deepEqual = (expected, actual) => {
* return chai.util.eql(expected, actual, {
* comparator: (expected, actual) => {
* // for non number comparison, use the default behavior
* if(typeof expected !== 'number') return null;
* // allow a difference of 10 between compared numbers
* return typeof actual === 'number' && Math.abs(actual - expected) < 10
* }
* })
* };
*
* @param {Function}
* @api public
*/
deepEqual: null
};

2

package.json

@@ -21,3 +21,3 @@ {

],
"version": "5.0.0-rc.0",
"version": "5.0.0",
"repository": {

@@ -24,0 +24,0 @@ "type": "git",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc