@cosmjs/utils
Advanced tools
Comparing version 0.22.3 to 0.23.0-alpha.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assert = void 0; | ||
exports.assertDefined = exports.assert = void 0; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
function assert(condition, msg) { | ||
@@ -10,2 +11,8 @@ if (!condition) { | ||
exports.assert = assert; | ||
function assertDefined(value, msg) { | ||
if (value === undefined) { | ||
throw new Error(msg || "value is undefined"); | ||
} | ||
} | ||
exports.assertDefined = assertDefined; | ||
//# sourceMappingURL=assert.js.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_1.assert; } }); | ||
Object.defineProperty(exports, "assertDefined", { enumerable: true, get: function () { return assert_1.assertDefined; } }); | ||
var sleep_1 = require("./sleep"); | ||
@@ -9,0 +10,0 @@ Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_1.sleep; } }); |
@@ -5,4 +5,10 @@ "use strict"; | ||
/** | ||
* Checks if data is a non-null object (i.e. matches the TypeScript object type) | ||
* Checks if data is a non-null object (i.e. matches the TypeScript object type). | ||
* | ||
* Note: this returns true for arrays, which are objects in JavaScript | ||
* even though array and object are different types in JSON. | ||
* | ||
* @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function isNonNullObject(data) { | ||
@@ -9,0 +15,0 @@ return typeof data === "object" && data !== null; |
{ | ||
"name": "@cosmjs/utils", | ||
"version": "0.22.3", | ||
"version": "0.23.0-alpha.0", | ||
"description": "Utility tools, primarily for testing code", | ||
@@ -33,3 +33,5 @@ "contributors": [ | ||
"format-types": "prettier --write --loglevel warn \"./types/**/*.d.ts\"", | ||
"build": "shx rm -rf ./build && tsc && yarn move-types && yarn format-types", | ||
"prebuild": "shx rm -rf ./build", | ||
"build": "tsc", | ||
"postbuild": "yarn move-types && yarn format-types", | ||
"build-or-skip": "[ -n \"$SKIP_BUILD\" ] || yarn build", | ||
@@ -45,3 +47,3 @@ "test-node": "node jasmine-testrunner.js", | ||
}, | ||
"gitHead": "ee205cc5f7b1154f2e8a5149092b19c82672b951" | ||
"gitHead": "5e79100fe341f7f745d28d8d4616912e2122e1ed" | ||
} |
export declare function assert(condition: any, msg?: string): asserts condition; | ||
export declare function assertDefined<T>(value: T | undefined, msg?: string): asserts value is T; |
export { arrayContentEquals } from "./arrays"; | ||
export { assert } from "./assert"; | ||
export { assert, assertDefined } from "./assert"; | ||
export { sleep } from "./sleep"; | ||
export { isNonNullObject, isUint8Array } from "./typechecks"; |
/** | ||
* Checks if data is a non-null object (i.e. matches the TypeScript object type) | ||
* Checks if data is a non-null object (i.e. matches the TypeScript object type). | ||
* | ||
* Note: this returns true for arrays, which are objects in JavaScript | ||
* even though array and object are different types in JSON. | ||
* | ||
* @see https://www.typescriptlang.org/docs/handbook/basic-types.html#object | ||
*/ | ||
@@ -4,0 +9,0 @@ export declare function isNonNullObject(data: unknown): data is object; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21407
123