UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

27 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSourceModule = exports.mergeImportOptions = exports.removeExportDefault = void 0; const _ = require("lodash"); const analyzer_1 = require("./preprocessor/analyzer"); const exportDefaultStr = 'export default'; function removeExportDefault(text) { if (text.startsWith(exportDefaultStr)) { text = text.substring(exportDefaultStr.length).trim(); } if (text.endsWith(';')) { text = text.slice(0, -1); } return text; } exports.removeExportDefault = removeExportDefault; function mergeImportOptions(src) { const baseOptions = _.cloneDeep(analyzer_1.defaultAnalysisOptions); return _.merge(baseOptions, src); } exports.mergeImportOptions = mergeImportOptions; /** * Checks if the given string refers to a Source module instead of a local module */ const isSourceModule = (path) => !path.startsWith('.') && !path.startsWith('/'); exports.isSourceModule = isSourceModule; //# sourceMappingURL=utils.js.map