noodl-loader
Version:
Loader for noodl applications
31 lines • 972 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const is = tslib_1.__importStar(require("../utils/is"));
const constants_1 = require("../constants");
function getAssetType(value) {
if (typeof value !== 'string')
return constants_1.AssetType.Unknown;
if (is.image(value)) {
return constants_1.AssetType.Image;
}
else if (is.script(value)) {
return constants_1.AssetType.Script;
}
else if (is.video(value)) {
return constants_1.AssetType.Video;
}
else if (is.text(value)) {
return constants_1.AssetType.Text;
}
else if (value.endsWith('pdf') ||
value.endsWith('json') ||
value.endsWith('doc')) {
return constants_1.AssetType.Document;
}
else {
return constants_1.AssetType.Text;
}
}
exports.default = getAssetType;
//# sourceMappingURL=get-asset-type.js.map