How to use pascalcase - 10 common examples

To help you get started, we’ve selected a few pascalcase 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 Manweill / swagger-axios-codegen / src / componentsCodegen / createDefinitionClass.ts View on Github external
let model: IClassDef = { name: className, props: [], imports: [] }
  const propertiesEntities = Object.entries(properties || {})
  for (const [k, v] of propertiesEntities) {
    // console.log('props name', k)
    let { propType, isEnum, isArray, isType, ref } = propTrueType(v);
    if (isEnum) {
      let enumName = `Enum${className}${pascalcase(k)}`
      enums.push({
        name: enumName, text: `export enum ${enumName}{
        ${propType}
      }`})
      propType = isArray ? enumName + '[]' : enumName
      ref = enumName
    }
    if (isType) {
      let typeName = `I${className}${pascalcase(k)}`
      enums.push({
        name: typeName, text: `type ${typeName} = ${propType};`
      })
      propType = isArray ? typeName + '[]' : typeName
      ref = typeName
    }
    // 转化引用值到引用列表
    if (!!ref) {
      model.imports.push(ref)
    }
    // propsStr += classPropsTemplate(k, propType, v.description)
    model.props.push({ name: k, type: propType, format: v.format, desc: v.description?.replace(/\//g, '\\/'), isType, isEnum })
  }
  // : classTemplate(className, propsStr, constructorStr)
  return { enums, model }
}
github angeloashmore / gatsby-source-prismic / src / node / generateTypeDefsForCustomType.js View on Github external
// The alternate languages field acts as a list of Link fields. Note:
  // AlternateLanguages is an internal plugin-specific type, not from Prismic.
  const alternateLanguagesFieldType = fieldToType(
    'alternate_languages',
    { type: 'AlternateLanguages' },
    [id],
    {
      ...context,
      customTypeId: id,
      enqueueTypePath,
    },
  )

  // Create a type for all data fields by shallowly mapping each field to a
  // type.
  const dataName = pascalcase(`Prismic ${id} Data Type`)
  const dataFieldTypes = R.mapObjIndexed(
    (field, fieldId) =>
      fieldToType(fieldId, field, [id, 'data'], {
        ...context,
        customTypeId: id,
        enqueueTypeDef,
        enqueueTypePath,
      }),
    dataFields,
  )
  enqueueTypePath([id, 'data'], dataName)
  enqueueTypeDef(
    gatsbySchema.buildObjectType({
      name: dataName,
      fields: dataFieldTypes,
      extensions: { infer: false },
github posva / pinia / rollup.config.js View on Github external
import rimraf from 'rimraf'
import pascalcase from 'pascalcase'

const cwd = process.cwd()
// eslint-disable-next-line
const pkg = require(path.join(cwd, 'package.json'))

rimraf.sync(path.join(cwd, './dist'))

const banner = `/*!
  * ${pkg.name} v${pkg.version}
  * (c) ${new Date().getFullYear()} Eduardo San Martin Morote
  * @license MIT
  */`

const exportName = pascalcase(pkg.name)

function createEntry({
  format, // Rollup format (iife, umd, cjs, es)
  external = ['vue', '@vue/composition-api'],
  input = 'src/index.ts', // entry point
  env = 'development', // NODE_ENV variable
  minify = false,
  isBrowser = false, // produce a browser module version or not
}) {
  // force production mode when minifying
  if (minify) env = 'production'

  const config = {
    input,
    plugins: [
      replace({
github Manweill / swagger-axios-codegen / src / definitionCodegen.ts View on Github external
function createDefinitionClass(
  className: string,
  properties: IDefinitionProperties
) {
  let propsStr = ''
  let constructorStr = ''
  let genericsType = ''
  /** 枚举值 */
  let enums = []
  const propertiesEntities = Object.entries(properties)
  for (const [k, v] of propertiesEntities) {
    let { propType, isEnum, isArray } = propTrueType(v);
    if (isEnum) {
      let enumName = `Enum${className}${pascalcase(k)}`
      enums.push({
        name: enumName, text: `export enum ${enumName}{
        ${propType}
      }`})
      propType = isArray ? enumName + '[]' : enumName
    }
    propsStr += `
    /** ${v.description || ''} */
    ${k}:${propType};\n
    `
    constructorStr += `this['${k}'] = data['${k}'];\n`
  }

  return {
    enums,
    model: `
github angeloashmore / gatsby-source-prismic / src / node / generateTypeDefsForCustomType.js View on Github external
enqueueTypePath([...depth, id], `[${groupName}]`)

      return `[${groupName}]`

    case 'Slice':
      const { sliceZoneId } = context
      const { 'non-repeat': primaryFields, repeat: itemsFields } = value

      const sliceFields = {
        id: 'String',
        slice_type: 'String',
      }

      if (primaryFields && !R.isEmpty(primaryFields)) {
        const primaryName = pascalcase(
          `Prismic ${customTypeId} ${sliceZoneId} ${id} Primary Type`,
        )

        enqueueTypeDef(
          gatsbySchema.buildObjectType({
            name: primaryName,
            fields: R.mapObjIndexed(
              (primaryField, primaryFieldId) =>
                fieldToType(
                  primaryFieldId,
                  primaryField,
                  [...depth, id, 'primary'],
                  context,
                ),
              primaryFields,
            ),
github hammerframework / hammer / packages / hammer-cli / src / commands / Generate / generators / service.js View on Github external
const files = ([serviceName, ..._rest]) => {
  const name = pascalcase(pluralize(serviceName))
  const camelName = camelcase(name)
  const outputPath = path.join(OUTPUT_PATH, `${camelName}.js`)
  const template = generateTemplate(
    path.join('service', 'service.js.template'),
    { name, camelName }
  )

  return { [outputPath]: template }
}
github angeloashmore / gatsby-source-prismic / src / node / generateTypeDefsForCustomType.js View on Github external
[...depth, id, 'primary'],
                  context,
                ),
              primaryFields,
            ),
            extensions: { infer: false },
          }),
        )

        enqueueTypePath([...depth, id, 'primary'], primaryName)

        sliceFields.primary = `${primaryName}`
      }

      if (itemsFields && !R.isEmpty(itemsFields)) {
        const itemName = pascalcase(
          `Prismic ${customTypeId} ${sliceZoneId} ${id} Item Type`,
        )

        enqueueTypeDef(
          gatsbySchema.buildObjectType({
            name: itemName,
            fields: R.mapObjIndexed(
              (itemField, itemFieldId) =>
                fieldToType(
                  itemFieldId,
                  itemField,
                  [...depth, id, 'items'],
                  context,
                ),
              itemsFields,
            ),
github hammerframework / hammer / packages / hammer-cli / src / commands / Generate / generators / cell.js View on Github external
const files = ([pageName, ..._rest]) => {
  const name = pascalcase(pageName) + 'Cell'
  const camelName = camelcase(pluralize(pageName))
  const outputPath = path.join(OUTPUT_PATH, name, `${name}.js`)
  const template = generateTemplate(path.join('cell', 'cell.js.template'), {
    name,
    camelName,
  })

  return { [outputPath]: template }
}
github superMDguy / tuxi / rollup.config.js View on Github external
fs.readdirSync('./lib/plugins').forEach(pluginFileName => {
  builds.push({
    input: `lib/plugins/${pluginFileName}`,
    output: {
      format: 'umd',
      name: `tuxi${pascalCase(pluginFileName.slice(0, -3))}`,
      file: `dist/plugins/${pluginFileName}`,
      globals: { vue: 'Vue', vuex: 'Vuex' }
    },
    plugins: [
      resolve(),
      commonjs(),
      babel({
        exclude: 'node_modules/**',
        babelrc: false,
        plugins: ['@babel/plugin-proposal-object-rest-spread']
      }),
      terser()
    ],
    external: ['vue']
  })
})
github hammerframework / hammer / packages / hammer-cli / src / commands / Generate / generators / layout.js View on Github external
const files = ([layoutName, ..._rest]) => {
  const name = pascalcase(layoutName) + 'Layout'
  const outputPath = path.join(OUTPUT_PATH, name, `${name}.js`)
  const template = generateTemplate(path.join('layout', 'layout.js.template'), {
    name,
    path,
  })

  return { [outputPath]: template }
}

pascalcase

Convert a string to pascal case (upper camelcase).

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis

Popular pascalcase functions