UNPKG

@novin-dev/formalite

Version:

Generate MUI form with few line of code

29 lines (24 loc) 1.02 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('react'); var getNameFromUrl = function (url) { return (url === null || url === void 0 ? void 0 : url.split(/[#?]/)[0].trim().split("/").pop()) || ""; }; var removeUrlExtras = function (url) { return (url === null || url === void 0 ? void 0 : url.split(/[#?]/)[0].trim()) || ""; }; var getExtensionFromUrl = function (file) { var _a, _b; if (file.original === "selected") { return file.name.split(".")[1]; } var lastPart = ((_a = removeUrlExtras(file.preview)) === null || _a === void 0 ? void 0 : _a.split("/")[(((_b = file.preview) === null || _b === void 0 ? void 0 : _b.split("/").length) || 1) - 1]) || ""; if (lastPart.includes(".")) { return lastPart.split(".")[1]; } return "jpg"; }; exports.getExtensionFromUrl = getExtensionFromUrl; exports.getNameFromUrl = getNameFromUrl; exports.removeUrlExtras = removeUrlExtras; //# sourceMappingURL=utils.js.map