當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。