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

core-assert

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-assert - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

34

index.js

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

// https://github.com/nodejs/node/blob/ded4f91eeff478a22e4a0eb5ba2c7ce811512c64/lib/assert.js
// https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27
// ------------------- //

@@ -46,2 +46,3 @@

var compare = require('buf-compare');
var isError = require('is-error');
// ------------------- //

@@ -308,2 +309,12 @@

function _tryBlock(block) {
var error;
try {
block();
} catch (e) {
error = e;
}
return error;
}
function _throws(shouldThrow, block, expected, message) {

@@ -321,7 +332,3 @@ var actual;

try {
block();
} catch (e) {
actual = e;
}
actual = _tryBlock(block);

@@ -335,3 +342,10 @@ message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +

if (!shouldThrow && expectedException(actual, expected)) {
var userProvidedMessage = typeof message === 'string';
var isUnwantedException = !shouldThrow && isError(actual);
var isUnexpectedException = !shouldThrow && actual && !expected;
if ((isUnwantedException &&
userProvidedMessage &&
expectedException(actual, expected)) ||
isUnexpectedException) {
fail(actual, expected, 'Got unwanted exception' + message);

@@ -350,8 +364,8 @@ }

assert.throws = function(block, /*optional*/error, /*optional*/message) {
_throws.apply(this, [true].concat(pSlice.call(arguments)));
_throws(true, block, error, message);
};
// EXTENSION! This is annoying to write outside this module.
assert.doesNotThrow = function(block, /*optional*/message) {
_throws.apply(this, [false].concat(pSlice.call(arguments)));
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
_throws(false, block, error, message);
};

@@ -358,0 +372,0 @@

{
"name": "core-assert",
"version": "0.1.3",
"version": "0.2.0",
"description": "Node.js `assert` as a standalone module",

@@ -39,4 +39,5 @@ "license": "MIT",

"dependencies": {
"buf-compare": "^1.0.0"
"buf-compare": "^1.0.0",
"is-error": "^2.2.0"
}
}
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