UNPKG

@storm-software/config-tools

Version:

⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.

26 lines (19 loc) 1.84 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs'); // src/utilities/file-path-utils.ts var _path = require('path'); var removeExtension = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (filePath) => { const result = !filePath || (filePath.match(/./g) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath; if (result.startsWith("./")) { return result.substring(2); } if (result.startsWith(".") || result.startsWith("/")) { return result.substring(1); } return result; }, "removeExtension"); function findFileName(filePath) { return _nullishCoalesce(_optionalChain([filePath, 'optionalAccess', _ => _.split, 'call', _2 => _2(_optionalChain([filePath, 'optionalAccess', _3 => _3.includes, 'call', _4 => _4(_path.sep)]) ? _path.sep : _optionalChain([filePath, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("/")]) ? "/" : "\\"), 'optionalAccess', _7 => _7.pop, 'call', _8 => _8()]), () => ( "")); } _chunkUSNT2KNTcjs.__name.call(void 0, findFileName, "findFileName"); exports.removeExtension = removeExtension; exports.findFileName = findFileName;