Socket
Socket
Sign inDemoInstall

@bunt/assert

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bunt/assert - npm Package Compare versions

Comparing version 0.29.15 to 0.29.16

30

dist/esm/assert.js

@@ -1,13 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toError = exports.pass = exports.fails = exports.validateTrue = exports.assert = void 0;
const is_1 = require("@bunt/is");
const index_js_1 = require("./Exception/index.js");
import { isFunction, isInstanceOf, isString } from "@bunt/is";
import { AssertionError } from "./Exception/index.js";
function createAssertionError(message, details) {
const description = (0, is_1.isFunction)(message) ? message() : message;
return (0, is_1.isInstanceOf)(description, Error)
const description = isFunction(message) ? message() : message;
return isInstanceOf(description, Error)
? description
: new index_js_1.AssertionError(description, details);
: new AssertionError(description, details);
}
function assert(expr, message, details) {
export function assert(expr, message, details) {
if (!expr) {

@@ -17,10 +14,8 @@ throw createAssertionError(message, details);

}
exports.assert = assert;
function validateTrue(result, details) {
if ((0, is_1.isString)(result)) {
export function validateTrue(result, details) {
if (isString(result)) {
throw createAssertionError(result, details);
}
}
exports.validateTrue = validateTrue;
function fails(expr, message, details) {
export function fails(expr, message, details) {
if (expr) {

@@ -30,4 +25,3 @@ throw createAssertionError(message, details);

}
exports.fails = fails;
function pass(value, transform, validator, label) {
export function pass(value, transform, validator, label) {
assert(value, `${label || "Value"} should be defined`);

@@ -38,4 +32,3 @@ const nextValue = transform(value);

}
exports.pass = pass;
function toError(error, alt = "Unexpected error") {
export function toError(error, alt = "Unexpected error") {
if (error instanceof Error) {

@@ -49,3 +42,2 @@ return error;

}
exports.toError = toError;
//# sourceMappingURL=assert.js.map

@@ -1,11 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssertionError = void 0;
const is_1 = require("@bunt/is");
const ValidationError_js_1 = require("./ValidationError.js");
class AssertionError extends ValidationError_js_1.ValidationError {
import { isFunction } from "@bunt/is";
import { ValidationError } from "./ValidationError.js";
export class AssertionError extends ValidationError {
details;
constructor(message, details) {
super(message || "Assertion fails");
this.details = (0, is_1.isFunction)(details)
this.details = isFunction(details)
? details()

@@ -18,3 +15,2 @@ : details;

}
exports.AssertionError = AssertionError;
//# sourceMappingURL=AssertionError.js.map

@@ -1,8 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isReadableError = void 0;
const isReadableError = (error) => {
export const isReadableError = (error) => {
return "toSafeJSON" in error && "toSafeString" in error;
};
exports.isReadableError = isReadableError;
//# sourceMappingURL=functions.js.map

@@ -1,23 +0,7 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./interfaces.js"), exports);
__exportStar(require("./PermissionError.js"), exports);
__exportStar(require("./ValidationError.js"), exports);
__exportStar(require("./AssertionError.js"), exports);
__exportStar(require("./NotFound.js"), exports);
__exportStar(require("./functions.js"), exports);
export * from "./interfaces.js";
export * from "./PermissionError.js";
export * from "./ValidationError.js";
export * from "./AssertionError.js";
export * from "./NotFound.js";
export * from "./functions.js";
//# sourceMappingURL=index.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=interfaces.js.map

@@ -1,7 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotFound = void 0;
class NotFound extends Error {
export class NotFound extends Error {
}
exports.NotFound = NotFound;
//# sourceMappingURL=NotFound.js.map

@@ -1,7 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PermissionError = void 0;
class PermissionError extends Error {
export class PermissionError extends Error {
}
exports.PermissionError = PermissionError;
//# sourceMappingURL=PermissionError.js.map

@@ -1,7 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationError = void 0;
class ValidationError extends Error {
export class ValidationError extends Error {
}
exports.ValidationError = ValidationError;
//# sourceMappingURL=ValidationError.js.map

@@ -1,19 +0,3 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./Exception/index.js"), exports);
__exportStar(require("./assert.js"), exports);
export * from "./Exception/index.js";
export * from "./assert.js";
//# sourceMappingURL=index.js.map
{
"name": "@bunt/assert",
"version": "0.29.15",
"version": "0.29.16",
"keywords": [

@@ -36,7 +36,7 @@ "typescript"

"dependencies": {
"@bunt/is": "^0.29.14",
"@bunt/type": "^0.29.14"
"@bunt/is": "^0.29.16",
"@bunt/type": "^0.29.16"
},
"license": "MIT",
"gitHead": "c51511e885a99ea220708c6329ffa4ac4550e14e"
"gitHead": "6d4993cad2d32f4c402b89685fc92f2db8df2cf6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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