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

code

Package Overview
Dependencies
Maintainers
5
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

29

lib/index.js

@@ -32,3 +32,3 @@ 'use strict';

++internals.count;
return new internals.Assertion(value, prefix, location);
return new internals.Assertion(value, prefix, location, at);
};

@@ -56,3 +56,3 @@

internals.Assertion = function (ref, prefix, location) {
internals.Assertion = function (ref, prefix, location, at) {

@@ -62,2 +62,3 @@ this._ref = ref;

this._location = location;
this._at = at;
this._flags = {};

@@ -118,3 +119,3 @@ };

error.expected = expected;
error.at = exports.thrownAt(error);
error.at = exports.thrownAt(error) || this._at;
throw error;

@@ -173,6 +174,6 @@ };

internals.addMethod('error', function (/*type, message*/) {
internals.addMethod('error', function (...args /*type, message*/) {
const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : Error;
const lastArg = arguments[1] || arguments[0];
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : Error;
const lastArg = args[1] || args[0];
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;

@@ -373,9 +374,9 @@ const err = this._ref;

internals.throw = function (/* type, message */) {
internals.throw = function (...args /* type, message */) {
internals.assert(this, typeof this._ref === 'function', 'Can only assert throw on functions');
internals.assert(this, !this._flags.not || !arguments.length, 'Cannot specify arguments when expecting not to throw');
internals.assert(this, !this._flags.not || !args.length, 'Cannot specify arguments when expecting not to throw');
const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null;
const lastArg = arguments[1] || arguments[0];
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : null;
const lastArg = args[1] || args[0];
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;

@@ -410,3 +411,3 @@

internals.reject = async function (/* type, message */) {
internals.reject = async function (...args/* type, message */) {

@@ -416,4 +417,4 @@ try {

const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null;
const lastArg = arguments[1] || arguments[0];
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : null;
const lastArg = args[1] || args[0];
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;

@@ -533,3 +534,3 @@

const frame = stack.replace(error.toString(), '').split('\n').slice(1).filter(internals.filterLocal)[0] || '';
const at = frame.match(/^\s*at \(?(.+)\:(\d+)\:(\d+)\)?$/);
const at = frame.match(/^\s*at [^(]*\(?(.+)\:(\d+)\:(\d+)\)?$/);
return Array.isArray(at) ? {

@@ -536,0 +537,0 @@ filename: at[1],

{
"name": "code",
"description": "assertion library",
"version": "5.2.0",
"version": "5.2.1",
"repository": "git://github.com/hapijs/code",

@@ -19,3 +19,3 @@ "main": "lib/index.js",

"devDependencies": {
"lab": "15.x.x",
"lab": "17.x.x",
"markdown-toc": "1.1.x"

@@ -22,0 +22,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