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

avow

Package Overview
Dependencies
Maintainers
4
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 4.0.2 to 4.0.3

circle.yml

41

index.js
'use strict'
const assert = require('assert')
const { parse } = require('parse-function')()
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,
const getMessageIndex = fn => {
const { args } = parse(fn)
return args.indexOf('message')
}

@@ -40,3 +13,3 @@

return function (...args) {
try { fn(...args) }
try { return fn(...args) }
catch (e) {

@@ -56,4 +29,4 @@ /**

*/
const index = messageArgumentIndex[methodName]
const message = index && args[index]
const index = getMessageIndex(fn)
const message = args[index]
if (message) throw message

@@ -60,0 +33,0 @@ throw e

{
"name": "avow",
"version": "4.0.2",
"version": "4.0.3",
"description": "Proxy for assert that accepts custom Errors",

@@ -30,3 +30,6 @@ "engines": {

"eslint": "^3.18.0"
},
"dependencies": {
"parse-function": "^5.0.7"
}
}

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