当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.lowerFirst函数代码示例

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


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

示例1: getAST

export const addModuleToState = (pathToAppActions: string, moduleName: string): void => {
  try {
    let file = fs.readFileSync(pathToAppActions, 'utf-8');

    getAST(file);

    file = insertAt(
      file,
      findAstNodes(sourceFile, ts.SyntaxKind.ObjectLiteralExpression, true).pop().end + 1,
      `\n  ${lowerFirst(moduleName)}: {\n    ...${upperFirst(moduleName)}DefaultState,\n  },`,
    );

    const interfaces: ts.Node[] = findAstNodes(sourceFile, ts.SyntaxKind.InterfaceDeclaration, true);

    file = insertAt(
      file,
      interfaces.shift().end - 2,
      `\n  ${lowerFirst(moduleName)}?: I${upperFirst(moduleName)}State;`,
    );

    file = insertAt(
      file,
      findAstNodes(sourceFile, ts.SyntaxKind.ImportDeclaration, true).pop().end,
      `\nimport { ${upperFirst(moduleName)}DefaultState, I${upperFirst(moduleName)}State }         from './${lowerFirst(moduleName)}/state';`,
    );

    fs.writeFileSync(pathToAppActions, file, { encoding: 'utf-8' });
  } catch (e) {
    throw new Error(e);
  }
};
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:ast.ts

示例2: parseOptions

// Parse the options in argv and split them into global options and renderer options,
// according to each option definition's `renderer` field.  If `partial` is false this
// will throw if it encounters an unknown option.
function parseOptions(definitions: OptionDefinition[], argv: string[], partial: boolean): Partial<CLIOptions> {
    let opts: { [key: string]: any };
    try {
        opts = commandLineArgs(definitions, { argv, partial });
    } catch (e) {
        assert(!partial, "Partial option parsing should not have failed");
        return messageError("DriverCLIOptionParsingFailed", { message: e.message });
    }

    const options: { rendererOptions: RendererOptions; [key: string]: any } = { rendererOptions: {} };
    for (const o of definitions) {
        if (!hasOwnProperty(opts, o.name)) continue;
        const v = opts[o.name] as string;
        if (o.renderer !== undefined) options.rendererOptions[o.name] = v;
        else {
            const k = _.lowerFirst(
                o.name
                    .split("-")
                    .map(_.upperFirst)
                    .join("")
            );
            options[k] = v;
        }
    }
    return options;
}
开发者ID:nrkn,项目名称:quicktype,代码行数:29,代码来源:index.ts

示例3: forOwn

 forOwn(tokens, (value: any, key: string) => {
     urlTemplate = this.replaceRouteTokens(urlTemplate, key, value);
     urlTemplate = this.replaceRouteTokens(urlTemplate, lowerFirst(key), value);
 });
开发者ID:grecosoft,项目名称:NetFusion,代码行数:4,代码来源:ApiRequest.ts

示例4: lowerFirst

export function lowerFirst(val: string): string {
  if (!val) return ''
  return _.lowerFirst(val)
}
开发者ID:seamusic,项目名称:cms,代码行数:4,代码来源:index.ts


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