UNPKG

ali-flmngr-server-fixed

Version:

> Node.js Backend for Flmngr file manager

18 lines 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPathWithNewName = exports.getFileNameWithoutExt = exports.areThereForbiddenCharacters = exports.getTitle = exports.getParentPath = exports.getLastDir = exports.flatten = void 0; const path_1 = __importDefault(require("path")); const last_1 = __importDefault(require("lodash/last")); exports.flatten = (lists) => { return lists.reduce((a, b) => a.concat(b), []); }; exports.getLastDir = (dirPath) => path_1.default.basename(dirPath); exports.getParentPath = (dirPath) => path_1.default.dirname(dirPath); exports.getTitle = (dirPath) => last_1.default(dirPath.split('/').slice(1)); exports.areThereForbiddenCharacters = (name) => /[/\\?%*:;|"<>. ]/.test(name); exports.getFileNameWithoutExt = (name) => name.split('.')[0]; exports.getPathWithNewName = (dirPath, name) => `${exports.getParentPath(dirPath)}/${name}`; //# sourceMappingURL=utils.js.map