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

assert-diff

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-diff - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

73

lib/index.js

@@ -1,68 +0,53 @@

"use strict";
var assert = require('assert-plus');
var jdiff = require('json-diff');
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.deepEqual = exports.deepStrictEqual = void 0;
var _assertPlus = _interopRequireDefault(require("assert-plus"));
var _jsonDiff = _interopRequireDefault(require("json-diff"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function AssertDiff() {
_assertPlus.default.ok.apply(_assertPlus.default.ok, arguments);
assert.ok.apply(assert.ok, arguments);
}
AssertDiff.options = {
strict: false
};
Object.keys(_assertPlus.default).forEach(function (k) {
AssertDiff[k] = function () {
_assertPlus.default[k].apply(_assertPlus.default[k], arguments);
AssertDiff.options = {strict: false};
Object.keys(assert).forEach(function(k) {
AssertDiff[k] = function() {
assert[k].apply(assert[k], arguments);
};
});
const deepStrictEqual = AssertDiff.deepStrictEqual = function deepStrictEqual() {
AssertDiff.deepStrictEqual = function deepStrictEqual() {
try {
_assertPlus.default.deepStrictEqual.apply(_assertPlus.default.deepStrictEqual, arguments);
assert.deepStrictEqual.apply(assert.deepStrictEqual, arguments);
} catch (e) {
throw new _assertPlus.default.AssertionError({
message: addDiffToMessage(e.message, _jsonDiff.default.diffString(e.expected, e.actual)),
stackStartFunction: _assertPlus.default.AssertionError
});
throw new assert.AssertionError({
message: addDiffToMessage(e.message, jdiff.diffString(e.expected, e.actual)),
stackStartFunction: assert.AssertionError
})
}
};
exports.deepStrictEqual = deepStrictEqual;
const deepEqual = AssertDiff.deepEqual = function deepEqual() {
AssertDiff.deepEqual = function deepEqual() {
try {
_assertPlus.default.deepEqual.apply(_assertPlus.default.deepEqual, arguments);
assert.deepEqual.apply(assert.deepEqual, arguments);
} catch (e) {
throw new _assertPlus.default.AssertionError({
message: addDiffToMessage(e.message, _jsonDiff.default.diffString(e.expected, e.actual)),
stackStartFunction: _assertPlus.default.AssertionError
});
throw new assert.AssertionError({
message: addDiffToMessage(e.message, jdiff.diffString(e.expected, e.actual)),
stackStartFunction: assert.AssertionError
})
}
if (AssertDiff.options.strict && _jsonDiff.default.diff(arguments[0], arguments[1])) {
throw new _assertPlus.default.AssertionError({
message: addDiffToMessage(arguments[2], _jsonDiff.default.diffString(arguments[0], arguments[1])),
stackStartFunction: _assertPlus.default.AssertionError
});
if (AssertDiff.options.strict && jdiff.diff(arguments[0], arguments[1])) {
throw new assert.AssertionError({
message: addDiffToMessage(arguments[2], jdiff.diffString(arguments[0], arguments[1])),
stackStartFunction: assert.AssertionError
})
}
};
exports.deepEqual = deepEqual;
function addDiffToMessage(message, diff) {
var msg = message ? message : '';
var resetCliColorAttributes = '\u001b[m';
return msg + resetCliColorAttributes + '\n' + diff;
}
AssertDiff.deepEqualOrig = _assertPlus.default.deepEqual;
var _default = AssertDiff;
exports.default = _default;
AssertDiff.deepEqualOrig = assert.deepEqual;
module.exports = AssertDiff;

@@ -14,3 +14,3 @@ {

"repository": "git://github.com/pihvi/assert-diff",
"version": "2.0.1",
"version": "2.0.2",
"main": "./lib",

@@ -17,0 +17,0 @@ "license": "Apache-2.0",

@@ -41,2 +41,5 @@ [![Greenkeeper badge](https://badges.greenkeeper.io/pihvi/assert-diff.svg)](https://travis-ci.org/pihvi/assert-diff) [![Known Vulnerabilities](https://snyk.io/test/npm/assert-diff/badge.svg)](https://snyk.io/test/npm/assert-diff)

### 2.0.2 July 30, 2018 ###
- Fix usage with assert(true) style
### 2.0.1 July 30, 2018 ###

@@ -43,0 +46,0 @@ - Fix v. 2.0.0 by adding the built index.js

@@ -1,2 +0,2 @@

var assert = require('./../lib/').default
var assert = require('./../lib/')
var assertOrig = require('assert')

@@ -3,0 +3,0 @@

Sorry, the diff of this file is not supported yet

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