How to use the change-case.paramCase function in change-case

To help you get started, we’ve selected a few change-case examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rodi01 / RenameIt / src / lib / Rename.js View on Github external
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
}
github alphagov / pay-frontend / app / models / card.js View on Github external
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) {
github ezy / seedpress-cms / server / api / post / controller.js View on Github external
.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);
        });
github sergeysova / material-styled / scripts / create.component.js View on Github external
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}"? `,
    },
github JetBrains / ring-ui / packages / ring-ui-generator / hub-widget / index.js View on Github external
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(() => {
github neutrinojs / neutrino / packages / neutrino / src / mocha.js View on Github external
.reduce((argv, key) => {
      const value = mocha[key];

      return value === true ?
        argv.concat(`--${toParam(key)}`) :
        argv.concat(`--${toParam(key)}`, mocha[key]);
    }, ['--require', require.resolve('./register')]);
github Yoast / wordpress-seo / plopfile.js View on Github external
function createBlockName( entityName ) {
	return BLOCK_PREFIX + paramCase( entityName );
}
github sergeysova / material-styled / scripts / create.component.js View on Github external
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)
github Thorium-Sim / thorium / src / containers / FlightDirector / SimulatorConfig / config / Library.js View on Github external
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="{&quot;select&quot;}" type="select">
                          this.updateEntry(
                            "seeAlso",
                            entry.seeAlso
                              .concat(e.target.value)
                              .filter((c, i, a) =&gt; a.indexOf(c) === i),
                          )
                        }