File "assert.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/error/assert/assert.ts
File size: 394 B (394 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { PROJECT_CODE } from '../../../constants/project';


/**
 * Throws an error if the provided condition is falsy.
 *
 * @param condition - If falsy, an error is thrown.
 * @param message   - Optional. A message to display.
 */
export function assert( condition: any, message?: string ): void {
  if ( ! condition ) {
    throw new Error( `[${ PROJECT_CODE }] ${ message || '' }` );
  }
}