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

@santi100/assertion-lib

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@santi100/assertion-lib - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

LICENSE

25

index.d.ts

@@ -1,4 +0,18 @@

class AssertionError extends Error {
constructor(expected: unknown, actual: unknown, operator: string): AssertionError;
declare class AssertionError extends Error {
constructor(expected: unknown, actual: unknown, operator: string);
}
declare interface AssertOptionalParams {
/**
* Expected value for the assertion.
*/
expected: unknown;
/**
* Received value for the assertion.
*/
actual: unknown;
/**
* Optional operator used for the assertion.
*/
operator?: string;
}
/**

@@ -9,5 +23,10 @@ * Asserts that ```condition``` is truthy.

* @param {boolean} condition A boolean condition to assert.
* @param {AssertOptionalParams} errorParams Parameters for the AssertionError that will be thrown
* in case the condition is falsy.
* @param {unknown} errorParams.expected Expected value for the assertion.
* @param {unknown} errorParams.actual Received value for the assertion.
* @param {string?} errorParams.operator Optional operator used for the assertion.
* @returns {void} Nothing.
*/
declare function assert(condition: boolean): void;
declare function assert(condition: boolean, { expected, actual, operator }?: AssertOptionalParams): void;
/**

@@ -14,0 +33,0 @@ * Asserts that the type of ```val``` is ```expectedType```.

2

index.js

@@ -7,3 +7,3 @@ class AssertionError extends Error {

}
function assert(condition, { expected, actual, operator }) {
function assert(condition, { expected = null, actual = null, operator = null }) {
if (!condition) throw new AssertionError(expected, actual, operator);

@@ -10,0 +10,0 @@ }

{
"name": "@santi100/assertion-lib",
"version": "1.0.1",
"version": "1.0.2",
"main": "index.js",

@@ -5,0 +5,0 @@ "license": "Other",

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