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


TypeScript lodash.capitalize函数代码示例

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


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

示例1: capitalize

  (node: VariableNode, resources: ResourceIndex): DropDownItem => {
    if (node.kind === "parameter_declaration") {
      return { label: capitalize(node.args.label), value: "?" };
    }

    const { data_value } = node.args;
    switch (data_value.kind) {
      case "coordinate":
        const { x, y, z } = data_value.args;
        return { label: `Coordinate (${x}, ${y}, ${z})`, value: "?" };
      case "identifier":
        return { label: capitalize(data_value.args.label), value: "?" };
      // tslint:disable-next-line:no-any
      case "every_point" as any:
        const { every_point_type } = (data_value as unknown as EveryPointShape).args;
        return everyPointDDI(safeEveryPointType(every_point_type));
      case "point":
        const { pointer_id, pointer_type } = data_value.args;
        const pointer =
          findPointerByTypeAndId(resources, pointer_type, pointer_id);
        return formatPoint(pointer);
      case "tool":
        const toolName = findToolById(resources, data_value.args.tool_id)
          .body.name || "Untitled tool";
        return { label: toolName, value: "X" };
      // tslint:disable-next-line:no-any // Empty, user must make a selection.
      case "nothing" as any:
        return NO_VALUE_SELECTED_DDI();
    }
    throw new Error("WARNING: Unknown, possibly new data_value.kind?");
  };
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:31,代码来源:sequence_meta.ts

示例2: getFunctionsEventProvider

export function getFunctionsEventProvider(eventType: string): string {
  // Legacy event types:
  const parts = eventType.split("/");
  if (parts.length > 1) {
    const provider = _.last(parts[1].split("."));
    return _.capitalize(provider);
  }
  // New event types:
  if (eventType.match(/google.pubsub/)) {
    return "PubSub";
  } else if (eventType.match(/google.storage/)) {
    return "Storage";
  } else if (eventType.match(/google.analytics/)) {
    return "Analytics";
  } else if (eventType.match(/google.firebase.database/)) {
    return "Database";
  } else if (eventType.match(/google.firebase.auth/)) {
    return "Auth";
  } else if (eventType.match(/google.firebase.crashlytics/)) {
    return "Crashlytics";
  } else if (eventType.match(/google.firestore/)) {
    return "Firestore";
  }
  return _.capitalize(eventType.split(".")[1]);
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:25,代码来源:utils.ts

示例3:

 name.split(/[ ]+/g).map(word => {
     word = word.replace(/DR\./, 'Drive')
     word = word.replace(/ST\./, 'Street')
     word = word.replace(/RD\./, 'Road')
     word = word.replace(/W\./, 'West')
     word = word.replace(/\\/g, '/')
     word = word.replace(/H\.S\./, 'High School')
     if (!word.match(/[\.\d]/)) word = capitalize(word)
     if (word.match(/^\(/)) word = `(${ capitalize(word.slice(1))}`
     words.push(word)
 })
开发者ID:osmottawa,项目名称:imports,代码行数:11,代码来源:get-data.ts

示例4: 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

示例5: capitalize

const mapper = (v: string, k: string) => {
  // "Reason: Explanation lorem ipsum dolor ipsum."
  const reason = capitalize(("" + k).split("_").join(" "));
  const explanation = v.toString();

  return t(`${reason}: ${explanation}`);
};
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:7,代码来源:errors.ts

示例6:

	export const sendActivateAccountEmail = (request: any, response: any, next: NextErr) => {

		console.log(`
	Sending email to: ${request.body.firstname}, 
	emailaddress: ${request.body.emailaddress}, 
	authorization: ${request.body.authorization}`);

		const email = {
			from: process.env.DO_NOT_REPLY,
			to: request.body.emailaddress,
			subject: 'Activate Tsawwassen Tennis Club Membership',
			html: `Hello ${_.capitalize(request.body.firstname)},
        <br><br>
        The Tsawwassen Tennis Club website has received an application for you to join our club.  
		Our apologies if this message was sent in error.
        <br><br>
        <a href="${fullUrl(request)}/#/activate-account?authorization=${request.body.authorization}">Click here to activate your account</a>
        <br><br>
        <b>Tswassasen Tennis Club</b>
        <br>
        <a href="${fullUrl(request)}/#/contact-us">Contact Us</a>
        <br>`
		}

		mailgun.messages().send(email)
			.then((data) => response.end())
			.catch(next);
	}
开发者ID:roderickmonk,项目名称:rod-monk-sample-repo-ng2,代码行数:28,代码来源:SendEmail.ts

示例7:

 .map(x => {
   return {
     label: `${x.headingId}: ${x.label}`,
     value: x.value,
     headingId: _.capitalize(x.headingId)
   };
 });
开发者ID:MrChristofferson,项目名称:Farmbot-Web-API,代码行数:7,代码来源:map_state_to_props_add_edit.ts

示例8: humanize

        .map(key => {
          const value = player.extra[key] as string[];

          return popupHelpers.createGeneralInformation(
            humanize(key),
            _.capitalize((Array.isArray(value) ? value[0] : value).trim())
          );
        })
开发者ID:bgotink,项目名称:IngressIdentity,代码行数:8,代码来源:profile.ts

示例9: async

const fetchIds = async (mt: MediaType, extId: string) => {
  const base = Airtable.base(config[mt].baseId)
  const records = await base(capitalize(config[mt].table))
    .select({ view: config[mt].view })
    .all()

  return records.map((record: any) => record.fields[extId])
}
开发者ID:xavdid,项目名称:kerfuffle,代码行数:8,代码来源:airtable.ts


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