• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.camelCase函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中lodash.camelCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript camelCase函数的具体用法?TypeScript camelCase怎么用?TypeScript camelCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了camelCase函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: processFile

async function processFile(filePath) {
  if (!fs.existsSync(filePath)) {
    return
  }
  const dirname = path.dirname(filePath)
  const distDirname = dirname.replace(sourceDir, tempDir)
  let distPath = path.format({dir: distDirname, base: path.basename(filePath)})
  const code = fs.readFileSync(filePath, 'utf-8')
  if (REG_STYLE.test(filePath)) {
    // do something
  } else if (REG_SCRIPTS.test(filePath)) {
    if (REG_TYPESCRIPT.test(filePath)) {
      distPath = distPath.replace(/\.(tsx|ts)(\?.*)?$/, '.js')
    }
    Util.printLog(processTypeEnum.COMPILE, _.camelCase(path.extname(filePath)).toUpperCase(), filePath)
    // transformJSCode
    const transformResult = transformJSCode({code, filePath, isEntryFile: isEntryFile(filePath), projectConfig})
    const jsCode = transformResult.code
    fs.ensureDirSync(distDirname)
    fs.writeFileSync(distPath, Buffer.from(jsCode))
    // compileDepStyles
    const styleFiles = transformResult.styleFiles
    depTree[filePath] = styleFiles
    await compileDepStyles(filePath, styleFiles)
  } else {
    fs.ensureDirSync(distDirname)
    fs.copySync(filePath, distPath)
    Util.printLog(processTypeEnum.COPY, _.camelCase(path.extname(filePath)).toUpperCase(), filePath)
  }
}
开发者ID:YangShaoQun,项目名称:taro,代码行数:30,代码来源:rn.ts


示例2: initProjectFile

function initProjectFile() {
  // generator app.json
  const appJsonObject = Object.assign({
    name: _.camelCase(require(path.join(process.cwd(), 'package.json')).name)
  }, rnConfig.appJson)
  // generator .${tempPath}/package.json TODO JSON.parse 这种写法可能会有隐患
  const pkgTempObj = JSON.parse(
    ejs.render(pkgTmpl, {
        projectName: _.camelCase(projectConfig.projectName),
        version: Util.getPkgVersion()
      }
    ).replace(/(\r\n|\n|\r|\s+)/gm, '')
  )
  const dependencies = require(path.join(process.cwd(), 'package.json')).dependencies
  pkgTempObj.dependencies = Object.assign({}, pkgTempObj.dependencies, dependencies)

  const indexJsStr = `
  import {AppRegistry} from 'react-native';
  import App from './${entryBaseName}';
  import {name as appName} from './app.json';

  AppRegistry.registerComponent(appName, () => App);`

  fs.writeFileSync(path.join(tempDir, 'index.js'), indexJsStr)
  Util.printLog(processTypeEnum.GENERATE, 'index.js', path.join(tempPath, 'index.js'))
  fs.writeFileSync(path.join(tempDir, 'app.json'), JSON.stringify(appJsonObject, null, 2))
  Util.printLog(processTypeEnum.GENERATE, 'app.json', path.join(tempPath, 'app.json'))
  fs.writeFileSync(path.join(tempDir, 'package.json'), JSON.stringify(pkgTempObj, null, 2))
  Util.printLog(processTypeEnum.GENERATE, 'package.json', path.join(tempPath, 'package.json'))
}
开发者ID:YangShaoQun,项目名称:taro,代码行数:30,代码来源:rn.ts


示例3: parseFunctionMetadata

export function parseFunctionMetadata({ prefixMap, name }) {
  let typeName;
  let methodName;

  const matchedPrefix = Object.keys(prefixMap).find(
    prefix => name.indexOf(prefix) === 0
  );
  if (matchedPrefix) {
    typeName = prefixMap[matchedPrefix];

    methodName = camelCase(name.replace(matchedPrefix, ''));
  } else {
    // The type name is the word before the first dash capitalized. If the type
    // is Vim, then it a editor-global method which will be attached to the Nvim
    // class.
    const parts = name.split('_');
    typeName = capitalize(parts[0]);
    methodName = camelCase(
      (typeName === 'Ui' ? parts : parts.slice(1)).join('_')
    );
  }

  return {
    typeName,
    methodName,
  };
}
开发者ID:billyvg,项目名称:node-client,代码行数:27,代码来源:parseFunctionMetadata.ts


示例4:

 return this.builderReady.then(() => {
   this.form.title = this.formTitle.nativeElement.value;
   this.form.display = this.formType.nativeElement.value;
   this.form.components = this.builder.formio.schema.components;
   if (this.config.tag) {
     this.form.tags = this.form.tags || [];
     this.form.tags.push(this.config.tag);
     this.form.tags = _.uniq(this.form.tags);
   }
   if (!this.form._id) {
     this.form.name = _.camelCase(this.form.title).toLowerCase();
     this.form.path = this.form.name;
   }
   return this.service.formio.saveForm(this.form).then(form => {
     this.form = this.service.setForm(form);
     this.loading = false;
     return this.form;
   }).catch(err => {
     this.loading = false;
     // Catch if a form is returned as an error. This is a conflict.
     if (err._id && err.type) {
       throw err;
     }
     this.alerts.setAlert({type: 'danger', message: (err.message || err)});
   });
 });
开发者ID:formio,项目名称:ng2-formio,代码行数:26,代码来源:edit.component.ts


示例5: getFieldData

 function getFieldData(field: Field): IColumnFieldData {
     const fieldName = field.fieldName;
     const fieldProps: IFieldProperties = field.properties;
     const modelMeta: IFieldMeta = getFieldMeta(config.model, fieldName);
     if (!modelMeta.list) { return null as IColumnFieldData; }
     let columnCode = "";
     const prefixCode = "";
     let hasValue = true;
     let render = null;
     let isRenderInline = true;
     switch (fieldProps.type) {
         case FieldType.Text:
         case FieldType.Password:
         case FieldType.File:
         case FieldType.Relation:
         case FieldType.List:
         case FieldType.Object:
             hasValue = false;
             break;
         // case FieldType.String:
         // case FieldType.Tel:
         // case FieldType.EMail:
         // case FieldType.URL:
         // case FieldType.Number:
         // case FieldType.Integer:
         // case FieldType.Float:
         //     break;
         case FieldType.Timestamp:
             isRenderInline = false;
             render = `dateTime.setTime(r.${fieldName});
             return dateTime.format("Y/m/d");`;
             break;
         case FieldType.Boolean:
             render = `tr(r.${fieldName} ? "yes" : "no")`;
             break;
         case FieldType.Enum:
             if (modelMeta.enum) {
                 // const listClass = file.getClass();
                 const enumName = camelCase(modelMeta.enum.options[0].split(".")[0]) + "Options";
                 const options = modelMeta.enum.options.map((option, index) => `${fieldProps.enum[index]}: tr("enum_${option.split(".")[1].toLowerCase()}")`);
                 // code = `const ${enumName} = {${options.join(', ')}};`;
                 render = `tr(${enumName}[r.${fieldName}])`;
                 // listClass.addProperty({ name: enumName, access: "private", defaultValue: `{${options.join(", ")}}` });
             }
             break;
     }
     if (hasValue) {
         if (render) {
             columnCode = isRenderInline ? `{ title: tr("fld_${fieldName}"), render: (r: ${model.interfaceName}) => ${render} }` : `{
         title: tr("fld_${fieldName}"),
         render: (r: ${model.interfaceName}) => {
             ${render}
         }
     }`;
         } else {
             columnCode = `{ name: "${fieldName}", title: tr("fld_${fieldName}") }`;
         }
     }
     return { column: columnCode, code: prefixCode };
 }
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:60,代码来源:genList.ts


示例6: mapToActionCreator

 mapToActionCreator(stream, actionType) {
   const actionCreator = this.actionCreators[camelCase(actionType)];
   if (!!actionCreator === false) {
     throw new Error(`No action creator defined for this action: ${actionType}`);
   }
   return stream.map(actionCreator);
 }
开发者ID:alessioalex,项目名称:tinydraft,代码行数:7,代码来源:oddstream.ts


示例7: getId

 createCustomElement: ({ selectedNodes }: Props) => (
   name = '',
   description = '',
   image = ''
 ): void => {
   if (selectedNodes.length) {
     const content = JSON.stringify({ selectedNodes });
     const customElement = {
       id: getId('custom-element'),
       name: camelCase(name),
       displayName: name,
       help: description,
       image,
       content,
     };
     customElementService
       .create(customElement)
       .then(() =>
         notify.success(
           `Custom element '${customElement.displayName || customElement.id}' was saved`
         )
       )
       .catch((result: Http2ServerResponse) =>
         notify.warning(result, {
           title: `Custom element '${customElement.displayName ||
             customElement.id}' was not saved`,
         })
       );
   }
 },
开发者ID:elastic,项目名称:kibana,代码行数:30,代码来源:element_handler_creators.ts


示例8: init

(async function init() {
  for (const commandPath of commandsPath) {
    const className = upperFirst(camelCase(commandPath.replace(/\./g, '-')));

    if (
      process.env.NODE_ENV !== 'production' &&
      filter &&
      `${filter}.command` !== commandPath
    ) {
      continue;
    }

    const classInterface = (await import(`./commands/${commandPath}`))[
      className
    ];

    const commandObject = new classInterface();
    try {
      yargs.command(commandObject);
    } catch (e) {
      console.log('ERROR ON COMMAND');
      console.log(e);
    }
  }

  yargs
    .demandCommand(1)
    .strict()
    .help('h')
    .alias('v', 'version').argv;
})();
开发者ID:pierophp,项目名称:pinyin,代码行数:31,代码来源:console.ts


示例9:

 source.split(/\s*;\s*/g).forEach(kv => {
   const [name, value] = kv.split(":");
   if (!name || !value) {
     return;
   }
   style[camelCase(name.trim())] = value.trim();
 });
开发者ID:cryptobuks,项目名称:tandem,代码行数:7,代码来源:xml.ts


示例10: compose

export function compose(): FrontendLibs {
  const api = new AxiosRestAPIAdapter(chrome.getXsrfToken(), chrome.getBasePath());
  const esAdapter = new RestElasticsearchAdapter(api, INDEX_NAMES.BEATS);
  const elasticsearchLib = new ElasticsearchLib(esAdapter);
  const configBlocks = new ConfigBlocksLib(
    new RestConfigBlocksAdapter(api),
    translateConfigSchema(configBlockSchemas)
  );
  const tags = new TagsLib(new RestTagsAdapter(api), elasticsearchLib);
  const tokens = new RestTokensAdapter(api);
  const beats = new BeatsLib(new RestBeatsAdapter(api), elasticsearchLib);

  const framework = new FrameworkLib(
    new KibanaFrameworkAdapter(
      camelCase(PLUGIN.ID),
      management,
      routes,
      chrome.getBasePath,
      onKibanaReady,
      XPackInfoProvider,
      chrome.getKibanaVersion()
    )
  );

  const libs: FrontendLibs = {
    framework,
    elasticsearch: elasticsearchLib,
    tags,
    tokens,
    beats,
    configBlocks,
  };
  return libs;
}
开发者ID:elastic,项目名称:kibana,代码行数:34,代码来源:kibana.ts



注:本文中的lodash.camelCase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.capitalize函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.bind函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap