mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-04 07:46:21 +02:00
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
"use strict";
|
|
/*
|
|
* @adonisjs/fold
|
|
*
|
|
* (c) Harminder Virk <virk@adonisjs.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ensureIsFunction = exports.isPrimtiveConstructor = exports.isEsm = void 0;
|
|
const utils_1 = require("@poppinss/utils");
|
|
/**
|
|
* Returns a boolean telling if value is an esm module
|
|
* with `export default`.
|
|
*/
|
|
function isEsm(value) {
|
|
return value && value.__esModule;
|
|
}
|
|
exports.isEsm = isEsm;
|
|
/**
|
|
* Returns a boolean telling if value is a primitive or object constructor.
|
|
*/
|
|
function isPrimtiveConstructor(value) {
|
|
return [String, Function, Object, Date, Number, Boolean].indexOf(value) > -1;
|
|
}
|
|
exports.isPrimtiveConstructor = isPrimtiveConstructor;
|
|
/**
|
|
* Raises error with a message when callback is not
|
|
* a function.
|
|
*/
|
|
function ensureIsFunction(callback, message) {
|
|
if (typeof callback !== 'function') {
|
|
throw new utils_1.Exception(message, 500, 'E_RUNTIME_EXCEPTION');
|
|
}
|
|
}
|
|
exports.ensureIsFunction = ensureIsFunction;
|