/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { isObject } from "#general";
import { DatatypeError } from "../../errors.js";
function assertNumber(value, path) {
  if (typeof value === "number") {
    return;
  }
  throw new DatatypeError(path, "a number", value);
}
function assertBoolean(value, path) {
  if (typeof value === "boolean" || value === 0 || value === 1) {
    return;
  }
  throw new DatatypeError(path, "a boolean", value);
}
function assertObject(value, path) {
  if (isObject(value)) {
    return;
  }
  throw new DatatypeError(path, "an object", value);
}
function assertNumeric(value, path) {
  if (typeof value === "number" || typeof value === "bigint") {
    return;
  }
  throw new DatatypeError(path, "a number or bigint", value);
}
function assertString(value, path) {
  if (typeof value === "string") {
    return;
  }
  throw new DatatypeError(path, "a string", value);
}
function assertBytes(value, path) {
  if (value instanceof Uint8Array) {
    return;
  }
  throw new DatatypeError(path, "a byte array", value);
}
function assertSequence(value, path) {
  if (typeof value === "string" || value instanceof Uint8Array) {
    return;
  }
  throw new DatatypeError(path, "a string or byte array", value);
}
function assertArray(value, path) {
  if (!Array.isArray(value)) {
    throw new DatatypeError(path, "an array", value);
  }
}
export {
  assertArray,
  assertBoolean,
  assertBytes,
  assertNumber,
  assertNumeric,
  assertObject,
  assertSequence,
  assertString
};
//# sourceMappingURL=assertions.js.map
