New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

run-time-assertions

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-time-assertions - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

dist/cjs/primitives.js

7

dist/cjs/assertion.error.js

@@ -8,5 +8,10 @@ "use strict";

super(...arguments);
this.name = 'AssertionError';
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AssertionError'
});
}
}
exports.AssertionError = AssertionError;

2

dist/cjs/index.js

@@ -21,3 +21,2 @@ "use strict";

__exportStar(require("./assertions"), exports);
__exportStar(require("./is-primitive"), exports);
__exportStar(require("./object/diff"), exports);

@@ -27,2 +26,3 @@ __exportStar(require("./object/has-property"), exports);

__exportStar(require("./object/is-promise"), exports);
__exportStar(require("./primitives"), exports);
__exportStar(require("./run-time-types"), exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertRunTimeType = exports.isRunTimeType = exports.getRunTimeType = void 0;
const assertion_error_1 = require("./assertion.error");
/** This function is not used at run time, it's only here for types. */

@@ -27,7 +28,8 @@ /* c8 ignore next 3 */

*/
function assertRunTimeType(input, testType, inputName) {
function assertRunTimeType(input, testType, failureMessage) {
if (!isRunTimeType(input, testType)) {
throw new TypeError(`'${inputName}' is of type '${getRunTimeType(input)}' but type '${testType}' was expected.`);
throw new assertion_error_1.AssertionError(failureMessage ||
`value is of type '${getRunTimeType(input)}' but type '${testType}' was expected.`);
}
}
exports.assertRunTimeType = assertRunTimeType;

@@ -5,4 +5,9 @@ /** An Error thrown by the run-time-assertions package when an assertion fails. */

super(...arguments);
this.name = 'AssertionError';
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AssertionError'
});
}
}

@@ -5,3 +5,2 @@ export * from './assert-throws';

export * from './assertions';
export * from './is-primitive';
export * from './object/diff';

@@ -11,2 +10,3 @@ export * from './object/has-property';

export * from './object/is-promise';
export * from './primitives';
export * from './run-time-types';

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

import { AssertionError } from './assertion.error';
/** This function is not used at run time, it's only here for types. */

@@ -22,6 +23,7 @@ /* c8 ignore next 3 */

*/
export function assertRunTimeType(input, testType, inputName) {
export function assertRunTimeType(input, testType, failureMessage) {
if (!isRunTimeType(input, testType)) {
throw new TypeError(`'${inputName}' is of type '${getRunTimeType(input)}' but type '${testType}' was expected.`);
throw new AssertionError(failureMessage ||
`value is of type '${getRunTimeType(input)}' but type '${testType}' was expected.`);
}
}

@@ -5,3 +5,2 @@ export * from './assert-throws';

export * from './assertions';
export * from './is-primitive';
export * from './object/diff';

@@ -11,2 +10,3 @@ export * from './object/has-property';

export * from './object/is-promise';
export * from './primitives';
export * from './run-time-types';

@@ -34,3 +34,3 @@ import type { AnyFunction } from '@augment-vir/common';

*/
export declare function assertRunTimeType<T extends RunTimeType>(input: unknown, testType: T, inputName: string): asserts input is RunTimeTypeMapping[T];
export declare function assertRunTimeType<T extends RunTimeType>(input: unknown, testType: T, failureMessage?: string | undefined): asserts input is RunTimeTypeMapping[T];
export {};
{
"name": "run-time-assertions",
"version": "0.3.0",
"version": "0.4.0",
"description": "Type safe assertions that work just as well in production run-times as they do in testing.",

@@ -53,11 +53,11 @@ "keywords": [

"dependencies": {
"@augment-vir/common": "^22.1.1",
"@augment-vir/common": "^23.3.2",
"expect-type": "~0.15.0",
"type-fest": "^4.9.0"
"type-fest": "^4.10.2"
},
"devDependencies": {
"@augment-vir/browser-testing": "^22.1.1",
"@augment-vir/browser-testing": "^23.3.2",
"@open-wc/testing": "^4.0.0",
"@types/mocha": "^10.0.6",
"@web/dev-server-esbuild": "^1.0.1",
"@web/dev-server-esbuild": "^1.0.2",
"@web/test-runner": "^0.18.0",

@@ -68,19 +68,19 @@ "@web/test-runner-commands": "^0.9.0",

"cspell": "^8.3.2",
"dependency-cruiser": "^16.0.0",
"esbuild": "^0.19.11",
"dependency-cruiser": "^16.2.0",
"esbuild": "^0.20.0",
"istanbul-smart-text-reporter": "^1.1.3",
"markdown-code-example-inserter": "^0.3.3",
"npm-check-updates": "~16.12.3",
"prettier": "^3.1.1",
"prettier": "3.2.5",
"prettier-plugin-interpolated-html-tags": "^1.0.3",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-multiline-arrays": "^3.0.1",
"prettier-plugin-multiline-arrays": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-packagejson": "^2.4.8",
"prettier-plugin-packagejson": "^2.4.11",
"prettier-plugin-sort-json": "^3.1.0",
"prettier-plugin-toml": "^2.0.1",
"run-time-assertions": "file:./",
"typedoc": "^0.25.6",
"run-time-assertions": "./",
"typedoc": "^0.25.8",
"typescript": "^5.3.3",
"virmator": "^11.1.5"
"virmator": "^11.3.3"
},

@@ -87,0 +87,0 @@ "overrides": {

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