import { ErrorProperties } from "../context" ; import { HttpStatus as HTTP } from "../status" ; import eql from "fast-deep-equal/es6" ; import { createHttpError } from "./error" ; export function assertFunc ( value , status = HTTP . InternalServerError , msg ? , opts ? ) { if ( value ) return ; throw createHttpError ( status , msg as any , opts as any ) ; } /**
 * Compares values using ==
 */ assertFunc . equal = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( a == b , status , msg , opts ) ; } ; /**
 * Compares values using !=
 */ assertFunc . notEqual = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( a != b , status , msg , opts ) ; } ; /**
 * Checks if the passed value is truthy
 */ assertFunc . ok = function ( value , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( value , status , msg , opts ) ; } ; /**
 * Compares values using ===
 */ assertFunc . strictEqual = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( a === b , status , msg , opts ) ; } ; /**
 * Compares values using !==
 */ assertFunc . notStrictEqual = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( a !== b , status , msg , opts ) ; } ; /**
 * Compares values using the `fast-deep-equal` library
 */ assertFunc . deepEqual = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( eql ( a , b ) , status , msg , opts ) ; } ; /**
 * Compares values using the `fast-deep-equal` library but negated
 */ assertFunc . notDeepEqual = function ( a , b , status = HTTP . InternalServerError , msg ? , opts ? ) { assertFunc ( ! eql ( a , b ) , status , msg , opts ) ; } ; export const assert = assertFunc ;