@fluidframework/core-utils
Advanced tools
Comparing version 2.23.0-323641 to 2.23.0
# @fluidframework/core-utils | ||
## 2.23.0 | ||
Dependency updates only. | ||
## 2.22.0 | ||
@@ -4,0 +8,0 @@ |
@@ -33,2 +33,18 @@ /*! | ||
/** | ||
* Throw an error with a constant message. | ||
* @remarks | ||
* Works like {@link assert}, but errors unconditionally instead of taking in a condition. | ||
* | ||
* Unlike `assert`, this `fail` is not "tagged" by the assert tagging too by default. | ||
* Use a `assertTagging.config.mjs` file to enable this and any other assert tagging customizations as needed. | ||
* | ||
* Returns `never` so it can be used inline as part of an expression, or as a return value. | ||
* @example | ||
* ```ts | ||
* const x: number = numbersMap.get("foo") ?? fail("foo missing from map"); | ||
* ``` | ||
* @internal | ||
*/ | ||
export declare function fail(message: string | number): never; | ||
/** | ||
* Asserts that can be conditionally enabled in debug/development builds but will be optimized out of production builds. | ||
@@ -35,0 +51,0 @@ * |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nonProductionConditionalsIncluded = exports.configureDebugAsserts = exports.debugAssert = exports.assert = void 0; | ||
exports.nonProductionConditionalsIncluded = exports.configureDebugAsserts = exports.debugAssert = exports.fail = exports.assert = void 0; | ||
/** | ||
@@ -37,3 +37,3 @@ * Asserts the specified condition. | ||
if (!condition) { | ||
throw new Error(typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message); | ||
fail(message); | ||
} | ||
@@ -43,2 +43,21 @@ } | ||
/** | ||
* Throw an error with a constant message. | ||
* @remarks | ||
* Works like {@link assert}, but errors unconditionally instead of taking in a condition. | ||
* | ||
* Unlike `assert`, this `fail` is not "tagged" by the assert tagging too by default. | ||
* Use a `assertTagging.config.mjs` file to enable this and any other assert tagging customizations as needed. | ||
* | ||
* Returns `never` so it can be used inline as part of an expression, or as a return value. | ||
* @example | ||
* ```ts | ||
* const x: number = numbersMap.get("foo") ?? fail("foo missing from map"); | ||
* ``` | ||
* @internal | ||
*/ | ||
function fail(message) { | ||
throw new Error(typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message); | ||
} | ||
exports.fail = fail; | ||
/** | ||
* Asserts that can be conditionally enabled in debug/development builds but will be optimized out of production builds. | ||
@@ -45,0 +64,0 @@ * |
@@ -5,3 +5,3 @@ /*! | ||
*/ | ||
export { assert, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { assert, fail, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { compareArrays } from "./compare.js"; | ||
@@ -8,0 +8,0 @@ export { delay } from "./delay.js"; |
@@ -7,5 +7,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.oob = exports.isPromiseLike = exports.isObject = exports.unreachableCase = exports.Timer = exports.setLongTimeout = exports.PromiseTimer = exports.shallowCloneObject = exports.Deferred = exports.PromiseCache = exports.LazyPromise = exports.Lazy = exports.NumberComparer = exports.Heap = exports.delay = exports.compareArrays = exports.nonProductionConditionalsIncluded = exports.configureDebugAsserts = exports.debugAssert = exports.assert = void 0; | ||
exports.oob = exports.isPromiseLike = exports.isObject = exports.unreachableCase = exports.Timer = exports.setLongTimeout = exports.PromiseTimer = exports.shallowCloneObject = exports.Deferred = exports.PromiseCache = exports.LazyPromise = exports.Lazy = exports.NumberComparer = exports.Heap = exports.delay = exports.compareArrays = exports.nonProductionConditionalsIncluded = exports.configureDebugAsserts = exports.debugAssert = exports.fail = exports.assert = void 0; | ||
var assert_js_1 = require("./assert.js"); | ||
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_js_1.assert; } }); | ||
Object.defineProperty(exports, "fail", { enumerable: true, get: function () { return assert_js_1.fail; } }); | ||
Object.defineProperty(exports, "debugAssert", { enumerable: true, get: function () { return assert_js_1.debugAssert; } }); | ||
@@ -12,0 +13,0 @@ Object.defineProperty(exports, "configureDebugAsserts", { enumerable: true, get: function () { return assert_js_1.configureDebugAsserts; } }); |
@@ -33,2 +33,18 @@ /*! | ||
/** | ||
* Throw an error with a constant message. | ||
* @remarks | ||
* Works like {@link assert}, but errors unconditionally instead of taking in a condition. | ||
* | ||
* Unlike `assert`, this `fail` is not "tagged" by the assert tagging too by default. | ||
* Use a `assertTagging.config.mjs` file to enable this and any other assert tagging customizations as needed. | ||
* | ||
* Returns `never` so it can be used inline as part of an expression, or as a return value. | ||
* @example | ||
* ```ts | ||
* const x: number = numbersMap.get("foo") ?? fail("foo missing from map"); | ||
* ``` | ||
* @internal | ||
*/ | ||
export declare function fail(message: string | number): never; | ||
/** | ||
* Asserts that can be conditionally enabled in debug/development builds but will be optimized out of production builds. | ||
@@ -35,0 +51,0 @@ * |
@@ -33,6 +33,24 @@ /*! | ||
if (!condition) { | ||
throw new Error(typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message); | ||
fail(message); | ||
} | ||
} | ||
/** | ||
* Throw an error with a constant message. | ||
* @remarks | ||
* Works like {@link assert}, but errors unconditionally instead of taking in a condition. | ||
* | ||
* Unlike `assert`, this `fail` is not "tagged" by the assert tagging too by default. | ||
* Use a `assertTagging.config.mjs` file to enable this and any other assert tagging customizations as needed. | ||
* | ||
* Returns `never` so it can be used inline as part of an expression, or as a return value. | ||
* @example | ||
* ```ts | ||
* const x: number = numbersMap.get("foo") ?? fail("foo missing from map"); | ||
* ``` | ||
* @internal | ||
*/ | ||
export function fail(message) { | ||
throw new Error(typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message); | ||
} | ||
/** | ||
* Asserts that can be conditionally enabled in debug/development builds but will be optimized out of production builds. | ||
@@ -39,0 +57,0 @@ * |
@@ -5,3 +5,3 @@ /*! | ||
*/ | ||
export { assert, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { assert, fail, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { compareArrays } from "./compare.js"; | ||
@@ -8,0 +8,0 @@ export { delay } from "./delay.js"; |
@@ -5,3 +5,3 @@ /*! | ||
*/ | ||
export { assert, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { assert, fail, debugAssert, configureDebugAsserts, nonProductionConditionalsIncluded, } from "./assert.js"; | ||
export { compareArrays } from "./compare.js"; | ||
@@ -8,0 +8,0 @@ export { delay } from "./delay.js"; |
{ | ||
"name": "@fluidframework/core-utils", | ||
"version": "2.23.0-323641", | ||
"version": "2.23.0", | ||
"description": "Not intended for use outside the Fluid client repo.", | ||
@@ -72,7 +72,7 @@ "homepage": "https://fluidframework.com", | ||
"@biomejs/biome": "~1.9.3", | ||
"@fluid-internal/mocha-test-setup": "2.23.0-323641", | ||
"@fluid-internal/mocha-test-setup": "~2.23.0", | ||
"@fluid-tools/benchmark": "^0.50.0", | ||
"@fluid-tools/build-cli": "^0.53.0", | ||
"@fluid-tools/build-cli": "^0.54.0", | ||
"@fluidframework/build-common": "^2.0.3", | ||
"@fluidframework/build-tools": "^0.53.0", | ||
"@fluidframework/build-tools": "^0.54.0", | ||
"@fluidframework/core-utils-previous": "npm:@fluidframework/core-utils@2.22.0", | ||
@@ -79,0 +79,0 @@ "@fluidframework/eslint-config-fluid": "^5.7.3", |
@@ -34,5 +34,3 @@ /*! | ||
if (!condition) { | ||
throw new Error( | ||
typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message, | ||
); | ||
fail(message); | ||
} | ||
@@ -42,2 +40,23 @@ } | ||
/** | ||
* Throw an error with a constant message. | ||
* @remarks | ||
* Works like {@link assert}, but errors unconditionally instead of taking in a condition. | ||
* | ||
* Unlike `assert`, this `fail` is not "tagged" by the assert tagging too by default. | ||
* Use a `assertTagging.config.mjs` file to enable this and any other assert tagging customizations as needed. | ||
* | ||
* Returns `never` so it can be used inline as part of an expression, or as a return value. | ||
* @example | ||
* ```ts | ||
* const x: number = numbersMap.get("foo") ?? fail("foo missing from map"); | ||
* ``` | ||
* @internal | ||
*/ | ||
export function fail(message: string | number): never { | ||
throw new Error( | ||
typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message, | ||
); | ||
} | ||
/** | ||
* Asserts that can be conditionally enabled in debug/development builds but will be optimized out of production builds. | ||
@@ -44,0 +63,0 @@ * |
@@ -8,2 +8,3 @@ /*! | ||
assert, | ||
fail, | ||
debugAssert, | ||
@@ -10,0 +11,0 @@ configureDebugAsserts, |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
317197
4290
0