Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let name = newLayerName.replace(/%\*u%/gi, changeCase.upperCase(layerName))
// LowerCase
name = name.replace(/%\*l%/gi, changeCase.lowerCase(layerName))
// Title Case
name = name.replace(/%\*t%/gi, toTitleCase(layerName))
// UpperCase First
name = name.replace(/%\*uf%/gi, changeCase.upperCaseFirst(layerName))
// Camel Case
name = name.replace(/%\*c%/gi, changeCase.camelCase(layerName))
// Param Case
name = name.replace(/%\*pc%/gi, changeCase.paramCase(layerName))
// Layername
name = name.replace(/%\*/g, layerName)
return name
}
if (response.statusCode === 404) {
return reject(new Error('Your card is not supported'))
}
if (response.statusCode === 422) {
return reject(new Error(i18n.__('fieldErrors.fields.cardNo.message')))
}
// if the server is down, or returns non 500, just continue
if (response.statusCode !== 200) {
return resolve()
}
const body = response.body
const card = {
brand: changeCase.paramCase(body.brand),
type: normaliseCardType(body.type),
corporate: body.corporate,
prepaid: body.prepaid
}
logger.debug(`[${correlationId}] Checking card brand`, {
cardBrand: card.brand,
cardType: card.type
})
if (_.filter(allowed, { brand: card.brand }).length === 0) {
reject(new Error(i18n.__('fieldErrors.fields.cardNo.unsupportedBrand', changeCase.titleCase(card.brand))))
}
if (!_.find(allowed, { brand: card.brand, type: card.type })) {
switch (card.type) {
.then((post) => {
if (!post) {
return res.status(404).send({
error: 'No post found'
});
}
// Update the post slug based on the title if title is new
const postTitle = req.body.postTitle ? req.body.postTitle.trim() : null;
if (req.body.postTitle && !post.dataValues.postSlug.includes(`${changeCase.paramCase(postTitle)}`)) {
let slug = postTitle ? `${changeCase.paramCase(postTitle)}-${Date.now()}` : null;
req.body.postSlug = slug;
}
let termsPromises = [];
if (req.body.postTerms) {
post.setPostTerms();
req.body.postTerms.forEach((term) => {
let { termType, termName } = term;
term.termSlug = `${changeCase.paramCase(termType)}-${changeCase.paramCase(termName)}`;
let termReq = Term.findOrCreate({where: {termSlug: term.termSlug}, defaults: { termType, termName }})
.spread((term2) => {
post.addPostTerm(term2);
});
termsPromises.push(termReq);
});
.map(fileName => changeCase.paramCase(fileName));
async function askForCreation(baseName, targetName, list) {
const baseNamePath = changeCase.paramCase(baseName)
const targetNamePath = changeCase.paramCase(targetName)
debug('Base name path:', baseNamePath, ':', baseName)
debug('Target name path:', targetNamePath, ':', targetName)
console.log('Files:')
list.forEach((file) => {
console.log('- ', chalk.green(file.replace(baseNamePath, targetNamePath)))
})
const result = await Inquirer.prompt([
{
name: 'create',
type: 'confirm',
message: `Create component "${targetName}"? `,
},
then(([answers, port, versions]) => {
const projectName = paramCase(answers.widgetName);
const camelCaseName = camelCase(answers.widgetName);
this.props = Object.assign({
projectName,
camelCaseName,
additionalDevServerOptions,
port
}, answers, versions);
}).
then(() => {
.reduce((argv, key) => {
const value = mocha[key];
return value === true ?
argv.concat(`--${toParam(key)}`) :
argv.concat(`--${toParam(key)}`, mocha[key]);
}, ['--require', require.resolve('./register')]);
function createBlockName( entityName ) {
return BLOCK_PREFIX + paramCase( entityName );
}
async function processComponentFiles(baseName, targetName, list) {
const baseNamePath = changeCase.paramCase(baseName)
const targetNamePath = changeCase.paramCase(targetName)
const pkg = JSON.parse(await readFile(resolve(__dirname, '..', 'packages', baseNamePath, 'package.json')))
const bar = new ProgressBar('Complete: :bar :current/:total', { total: list.length, complete: '◾', incomplete: '◽' })
for (let i = 0; i < list.length; i++) {
const basePath = resolve(__dirname, '..', list[i])
const targetPath = resolve(__dirname, '..', list[i].replace(baseNamePath, targetNamePath))
debug('Process file', basePath, '=>', targetPath)
const baseSource = await readFile(basePath, 'utf8')
const newSource = baseSource.toString()
.replace(pkg.description, `{Description for ${targetName}}`)
.replace(new RegExp(baseNamePath, 'g'), targetNamePath)
this.updateEntry(
"categories",
entry.categories.filter(a => a !== s),
)
}
/>
))}
<label>Slug</label>
<input readonly="" value="{paramCase(entry.title)}" type="text">
<label>See Also</label>
<input value="{"select"}" type="select">
this.updateEntry(
"seeAlso",
entry.seeAlso
.concat(e.target.value)
.filter((c, i, a) => a.indexOf(c) === i),
)
}