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

avow

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avow - npm Package Compare versions

Comparing version 3.0.2 to 4.0.2

yarn.lock

44

index.js

@@ -5,3 +5,36 @@ 'use strict'

function avowify(fn) {
const messageArgumentIndex = {
// assert(value[, message])
undefined: 1,
// assert.deepEqual(actual, expected[, message])
deepEqual: 2,
// assert.deepStrictEqual(actual, expected[, message])
deepStrictEqual: 2,
// assert.doesNotThrow(block[, error][, message])
doesNotThrow: 2,
// assert.equal(actual, expected[, message])
equal: 2,
// Ignoring "fail" expecting message as third argument
// assert.fail(message)
// assert.fail(actual, expected[, message[, operator[, stackStartFunction]]])
fail: 0,
// assert.ifError(value)
ifError: Infinity,
// assert.notDeepEqual(actual, expected[, message])
notDeepEqual: 2,
// assert.notDeepStrictEqual(actual, expected[, message])
notDeepStrictEqual: 2,
// assert.notEqual(actual, expected[, message])
notEqual: 2,
// assert.notStrictEqual(actual, expected[, message])
notStrictEqual: 2,
// assert.ok(value[, message])
ok: 1,
// assert.strictEqual(actual, expected[, message])
strictEqual: 2,
// assert.throws(block[, error][, message])
throws: 2,
}
function avowify(fn, methodName) {
return function (...args) {

@@ -23,4 +56,5 @@ try { fn(...args) }

*/
const lastArg = args[args.length - 1]
if (lastArg instanceof Error) throw lastArg
const index = messageArgumentIndex[methodName]
const message = index && args[index]
if (message) throw message
throw e

@@ -33,5 +67,5 @@ }

// e.g. avow.equal(...)
get: (target, method) => avowify(target[method]),
get: (target, methodName) => avowify(target[methodName], methodName),
// e.g. avow(...)
apply: (target, thisArg, args) => avowify(target).apply(thisArg, args)
apply: (target, thisArg, args) => avowify(target, undefined).apply(thisArg, args)
}

@@ -38,0 +72,0 @@

9

package.json
{
"name": "avow",
"version": "3.0.2",
"version": "4.0.2",
"description": "Proxy for assert that accepts custom Errors",

@@ -10,3 +10,4 @@ "engines": {

"scripts": {
"test": "ava test"
"test": "ava test",
"test-watch": "ava -w test"
},

@@ -28,5 +29,5 @@ "repository": {

"devDependencies": {
"ava": "^0.18.2",
"ava": "^0.22.0",
"eslint": "^3.18.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