當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.upperFirst函數代碼示例

本文整理匯總了TypeScript中lodash.upperFirst函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript upperFirst函數的具體用法?TypeScript upperFirst怎麽用?TypeScript upperFirst使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了upperFirst函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例3: upperFirst

      .map((response:any) => {
        var result = response.json(),
            name = result.name;

        result.img = 'http://img.pokemondb.net/artwork/' + name + '.jpg';
        result.name = upperFirst(name);

        cache.pokemon.set(id, result);
        return result;
      });
開發者ID:WebAppsAndFrameworks,項目名稱:ng2-app,代碼行數:10,代碼來源:pokemon.service.ts

示例4: welcomeOAuth

	public async welcomeOAuth(requestState: RequestState, user: UserDocument): Promise<SentMessageInfo> {
		const strategyNames: { [key: string]: string } = {
			github: 'GitHub',
			google: 'Google',
			gameex: 'GameEx',
		};
		return this.sendEmail(requestState, user, 'Welcome to VPDB!', 'welcome-oauth', {
			user,
			profileUrl: settings.webUri('/profile/settings'),
			strategy: strategyNames[user.provider] || upperFirst(user.provider),
		});
	}
開發者ID:freezy,項目名稱:node-vpdb,代碼行數:12,代碼來源:mailer.ts

示例5: constructor

    constructor(private config: IComponentGenConfig) {
        const className = upperFirst(camelCase(config.name));
        let path = `${Vesta.directories.components}/${config.path}`;
        mkdir(path);
        if (this.config.hasStyle) {
            genSass(className, path);
        }

        if (config.model) {
            path = `${path}/${className}`;
        }
    }
開發者ID:VestaRayanAfzar,項目名稱:vesta,代碼行數:12,代碼來源:ComponentGen.ts

示例6: addProperty

 addProperty(layoutElements: {}[], property: {}, name: string, path: string) {
     if (property['type'] == 'object') {
         let sublayout: {} = {
             'type': 'Group',
             'label': _.upperFirst(name),
             'elements': []
         };
         _.forEach(property['properties'], (subproperty: any, subname: string) => {
             this.addProperty(sublayout['elements'], subproperty, subname, path + name + '/properties/');
         });
         layoutElements.push(sublayout);
     } else {
         let control: {} = {
             'type': 'Control',
             'label': _.upperFirst(name),
             'scope': {
                 '$ref': path + name
             }
         };
         layoutElements.push(control);
     }
 }
開發者ID:eclipsesource,項目名稱:jsonforms-swagger,代碼行數:22,代碼來源:query-uischema-generator.service.ts

示例7: validate

 public validate(
   _pipeline: IPipeline,
   stage: IStage | ITrigger,
   validationConfig: IServiceFieldValidatorConfig,
 ): string {
   const serviceInput: ICloudFoundryServiceManifestSource = get(stage, 'manifest');
   if (sourceType(serviceInput, get(stage, 'userProvided')) !== validationConfig.manifestSource) {
     return null;
   }
   const manifestSource: any = get(serviceInput, sourceStruct(serviceInput));
   const content: any = get(manifestSource, validationConfig.fieldName);
   const fieldLabel = validationConfig.fieldLabel || upperFirst(validationConfig.fieldName);
   return content ? null : `<strong>${fieldLabel}</strong> is a required field for the Deploy Service stage.`;
 }
開發者ID:emjburns,項目名稱:deck,代碼行數:14,代碼來源:cloudfoundryDeployServiceStage.module.ts

示例8:

    return this.$q.all(promises).then(results => {
      let status = 'success';
      let message = '';

      for (let i = 0; i < results.length; i++) {
        if (results[i].status !== 'success') {
          status = results[i].status;
        }
        message += `${i + 1}. ${results[i].message} `;
      }

      return {
        status: status,
        message: message,
        title: _.upperFirst(status),
      };
    });
開發者ID:CorpGlory,項目名稱:grafana,代碼行數:17,代碼來源:datasource.ts


注:本文中的lodash.upperFirst函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。