MCPcopy Create free account
hub / github.com/bitanath/pca / assertNotNull

Function assertNotNull

src/assert.ts:3–7  ·  view source on GitHub ↗
(value: T | null | undefined, fieldName: string)

Source from the content-addressed store, hash-verified

1import type { Matrix } from "./type.js";
2
3export function assertNotNull<T>(value: T | null | undefined, fieldName: string): asserts value is T {
4 if (value == null) {
5 throw new Error(`->${fieldName} is null or undefined`);
6 }
7}
8
9export function assertDefined<T>(value: T | undefined, defaultValue: T): T {
10 return typeof value === "undefined" ? defaultValue : value;

Callers 2

assertMatrixElementsFunction · 0.85
svdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected