Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deep-equal-in-any-order

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-equal-in-any-order - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

32

build/index.js
'use strict';
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _sortAny = require('sort-any');
var _sortAny2 = _interopRequireDefault(_sortAny);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const sortDeep = object => {
if (!Array.isArray(object)) {
if (!(typeof object === 'object') || object === null) {
return object;
}
return _lodash2.default.mapValues(object, sortDeep);
}
return (0, _sortAny2.default)(object.map(sortDeep));
};
module.exports = (chai, utils) => {
const { Assertion } = chai;
utils.addMethod(Assertion.prototype, 'equalInAnyOrder', () => {});
utils.addMethod(Assertion.prototype, 'equalInAnyOrder', function equalInAnyOrder(b) {
const a = this.__flags.object;
const { negate } = this.__flags;
if (negate) {
new Assertion(sortDeep(a)).to.not.deep.equal(sortDeep(b));
} else {
new Assertion(sortDeep(a)).to.deep.equal(sortDeep(b));
}
});
};
{
"name": "deep-equal-in-any-order",
"version": "1.0.8",
"version": "1.0.9",
"description": "chai plugin to match objects and arrays deep equality with arrays (including nested ones) being in any order",

@@ -50,3 +50,7 @@ "main": "build/index.js",

"sinon-chai": "^2.9.0"
},
"dependencies": {
"lodash": "^4.17.10",
"sort-any": "^1.1.12"
}
}
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