Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import changeCase from 'change-case';
export default {
camelCase: changeCase.camel,
snakeCase: changeCase.snake,
dotCase: changeCase.dot,
pathCase: changeCase.path,
lowerCase: changeCase.lower,
upperCase: changeCase.upper,
sentenceCase: changeCase.sentence,
constantCase: changeCase.constant,
titleCase: changeCase.title,
dashCase: changeCase.param,
kabobCase: changeCase.param,
kebabCase: changeCase.param,
properCase: changeCase.pascal,
pascalCase: changeCase.pascal
};
function getSanitizedName(name, allowUnderscores) {
name = changeCase.snake(name);
return (!allowUnderscores) ? name.replace(/_/g, '') : name;
}
funcs.set('snake', (_: Context, v: string) => cc.snake(v));
funcs.set('pascal', (_: Context, v: string) => cc.pascal(v));
function generateFileName(fileName, { prefix, suffix }) {
const prefixStr = prefix ? `${prefix}-` : '';
const suffixStr = suffix ? `-${suffix}` : '';
return `${changeCase.snake(prefixStr + fileName.replace('.svg', '') + suffixStr)}`;
}
function makeLanguageSpecificName(methodName: string): string {
return args.language === 'Python' ? changeCase.snake(methodName) : methodName;
}
toPythonIdentifier(input: string): string {
let snakeCased = changeCase.snake(input);
const pythonReservedWords = [
'False',
'None',
'True',
'and',
'as',
'assert',
'break',
'class',
'continue',
'def',
'del',
'elif',
'else',
'except',
'finally',
function (board, next) {
fs.writeJson(path.resolve(targetDir,
boardInfo.id + '-' + changeCase.snake(boardInfo.title || 'untitled') + '.json'),
board, next);
}
],
function generateFileName(fileName, {
prefix,
suffix
}) {
const prefixStr = prefix ? `${prefix}-` : '';
const suffixStr = suffix ? `-${suffix}` : '';
return `${changeCase.snake(prefixStr + fileName.replace('.svg', '') + suffixStr)}`;
}