Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
files.forEach(function (file) {
var name = path.basename(file).split('.')[0];
var filePath = getFilePath(opts.sourcePath, file, subDir);
var dir = filePath.split('/')[0];
if (dir) {
if (!dirMap[dir]) {
dirMap[dir] = [];
if (shouldExport) {
var dirName = camelcase_1.default(dir, {
pascalCase: true
});
content += isES6
? "export * as " + dirName + " from './" + dir + "'\n"
: "module.exports." + dirName + " = require('./" + dir + "')\n";
}
else {
content += isES6
? "import './" + dir + "'\n"
: "require('./" + dir + "')\n";
}
}
dirMap[dir].push(file);
}
else {
if (shouldExport) {
export function toPascalCase(...args: string[]): string {
return camelcase(args, { pascalCase: true });
}
});
content += isES6
? "export * as " + dirName + " from './" + dir + "'\n"
: "module.exports." + dirName + " = require('./" + dir + "')\n";
}
else {
content += isES6
? "import './" + dir + "'\n"
: "require('./" + dir + "')\n";
}
}
dirMap[dir].push(file);
}
else {
if (shouldExport) {
var fileName = camelcase_1.default(name, {
pascalCase: true
});
content += isES6
? "export " + fileName + " from './" + filePath + name + "'\n"
: "module.exports." + fileName + " = require('./" + filePath + name + "')\n";
}
else {
content += isES6
? "import './" + filePath + name + "'\n"
: "require('./" + filePath + name + "')\n";
}
}
});
fs.writeFileSync(path.join(opts.targetPath, subDir, "index." + opts.ext), content, 'utf-8');
public convertParameterName(original: string) {
if (this.isInvalidName(original)) {
throw new Error(`Invalid parameter name: ${original}`);
}
const name = camelcase(original);
return this.escapeParameterName(name);
}
export function toCamelCase(...args: string[]): string {
return camelcase(args);
}