🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

typed-assert

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-assert - npm Package Compare versions

Comparing version

to
1.0.6

5

build/__tests__/index.test.js

@@ -50,2 +50,7 @@ "use strict";

t.setBaseAssert(baseAssert);
test("isUnknown", () => {
for (const value of Object.values(fixtures)) {
expect(() => t.isUnknown(value)).not.toThrow();
}
});
test("isNotNull", () => {

@@ -52,0 +57,0 @@ const v = orNull(fixtures.string);

1

build/index.d.ts

@@ -9,2 +9,3 @@ export declare type WeakAssert = (input: unknown, message?: string) => void;

export declare const safeJsonParse: (json: string) => unknown;
export declare function isUnknown(_input: unknown): _input is unknown;
export declare function isNotNull<T>(input: null | T, message?: string): asserts input is T;

@@ -11,0 +12,0 @@ export declare function isNotUndefined<T>(input: undefined | T, message?: string): asserts input is T;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.check = exports.isPromise = exports.isInstanceOf = exports.isOneOfType = exports.isOneOf = exports.isOptionOfType = exports.isArrayOfType = exports.isRecordOfType = exports.isArray = exports.isRecordWithKeys = exports.isRecord = exports.isDate = exports.isString = exports.isNumber = exports.isBoolean = exports.isExactly = exports.isNotUndefined = exports.isNotNull = exports.safeJsonParse = exports.setBaseAssert = exports.assert = exports.defaultAssert = void 0;
exports.check = exports.isPromise = exports.isInstanceOf = exports.isOneOfType = exports.isOneOf = exports.isOptionOfType = exports.isArrayOfType = exports.isRecordOfType = exports.isArray = exports.isRecordWithKeys = exports.isRecord = exports.isDate = exports.isString = exports.isNumber = exports.isBoolean = exports.isExactly = exports.isNotUndefined = exports.isNotNull = exports.isUnknown = exports.safeJsonParse = exports.setBaseAssert = exports.assert = exports.defaultAssert = void 0;
const expectedToBe = (type) => `expected to be ${type}`;

@@ -19,2 +19,6 @@ exports.defaultAssert = (condition, message) => {

exports.safeJsonParse = (json) => JSON.parse(json);
function isUnknown(_input) {
return true;
}
exports.isUnknown = isUnknown;
function isNotNull(input, message = expectedToBe("not null")) {

@@ -21,0 +25,0 @@ exports.assert(input !== null, message);

2

package.json
{
"name": "typed-assert",
"version": "1.0.5",
"version": "1.0.6",
"description": "typesafe assertion library for TypeScript 3.7+",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -56,2 +56,9 @@ import nodeAssert from "assert";

t.setBaseAssert(baseAssert);
test("isUnknown", () => {
for (const value of Object.values(fixtures)) {
expect(() => t.isUnknown(value)).not.toThrow();
}
});
test("isNotNull", () => {

@@ -58,0 +65,0 @@ const v = orNull(fixtures.string);

@@ -36,2 +36,6 @@ const expectedToBe = (type: string): string => `expected to be ${type}`;

export function isUnknown(_input: unknown): _input is unknown {
return true;
}
export function isNotNull<T>(

@@ -38,0 +42,0 @@ input: null | T,

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