How to use capitalize - 10 common examples

To help you get started, we’ve selected a few capitalize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github luqin / react-component-tools / src / index.js View on Github external
function prepareConfig(_config) {
  const pkg = readPackageJSON();
  const name = capitalize(camelCase(_config.component.pkgName || pkg.name));

  let config = defaults(_config, { alias: pkg.alias });

  // component
  config.component = defaults(config.component, {
    entry: './src/index.js',
    pkgName: pkg.name,
    name: name,
    dependencies: pkg.deps,
    src: './src',
    lib: './lib',
    dist: './dist',
  });

  config.bump = config.bump || {};
  config.bump = defaults(config.bump, {
github assetgraph / assetgraph / lib / util / fonts / getTextByFontProperties.js View on Github external
const props = {};
          for (const prop of CSS_PROPS_TO_TRACE_AND_TEXT) {
            props[prop] = hypotheticalValueByProp[prop].value;
          }
          // Apply text-transform:
          const textTransform = props['text-transform'];
          if (
            textTransform !== 'none' &&
            !hypotheticalValueByProp.text.isListIndicator
          ) {
            if (textTransform === 'uppercase') {
              props.text = props.text.toUpperCase();
            } else if (textTransform === 'lowercase') {
              props.text = props.text.toLowerCase();
            } else if (textTransform === 'capitalize') {
              props.text = capitalize.words(props.text);
            }
          }
          return props;
        })
        .filter(function filterAndDeduplicate(textWithProps) {
github foundation / octophant / lib / processSassDoc.js View on Github external
for (var i in sass) {
    if (sass[i].length === 0) delete sass[i];
  }

  // Get a list of all groups
  groupList = Object.keys(sass);

  // Sort groups by user-defined categories
  for (var i in sort) {
    var index = groupList.indexOf(sort[i]);
    groupList = move(groupList, index, 0);
  }

  // Finally, build a new object with the sorted groups
  for (var i in groupList) {
    var group = groups[groupList[i]] || capitalize.words(groupList[i].replace('-', ' '));
    sassSorted[group] = sass[groupList[i]];
  }

  return sassSorted;
}
github olymp / olymp / src2 / cms / views / collections / list.js View on Github external
const columns = fields.map((meta) => {
      const { name, description } = meta;

      return {
        title: description && description.indexOf('title:') !== -1 ? description.split('title:')[1].split('\n')[0] : capitalize(name),
        dataIndex: name,
        key: name,
        ...columnHelper(meta, items)
      }
    });
github kiwicom / orbit-components / config / build.js View on Github external
const names = files.map(inputFileName => {
  const baseName = path.basename(inputFileName).replace(/( \(custom\))?\.svg$/, "");
  const functionName = capitalize(camelcase(baseName));
  const outputComponentFileName = `${functionName}.js`;

  return {
    inputFileName,
    outputComponentFileName,
    functionName,
    baseName,
  };
});
github benji6 / andromeda / src / plugins / instruments / Prometheus / components / ModuleFilter.js View on Github external
Object.keys(typesToParams).map(type => createElement('option', {
      key: type,
      value: type,
    }, capitalize(type)))
    ),
github Nike-Inc / referee / packages / client / src / components / reports / canary / MetricGroup.tsx View on Github external
render(): React.ReactNode {
    const groupScore = this.props.groupScoreByMetricGroupNameMap[this.props.metricGroupName].score;
    const humanReadableScore = Number(groupScore.toFixed(2));
    const scoreLabel = capitalize(getGroupClassFromScore(groupScore, this.props.thresholds));
    const { metricGroupName } = this.props;

    return (
      <div>
        <div>
          {/*<div>Name: {metricGroupName}</div>*/}
          {/*<div>Score: {humanReadableScore}</div>*/}
          {/*<div>Label: {scoreLabel}</div>*/}
        </div>
        <div>
          {this.props.idListByMetricGroupNameMap[this.props.metricGroupName].map(id =&gt; {
            const canaryAnalysisResult: CanaryAnalysisResult = this.props.canaryAnalysisResultByIdMap[id];
            const metricName = canaryAnalysisResult.name;
            const metricSetPair: MetricSetPair = this.props.metricSetPairsByIdMap[id];
            const canaryMetricConfig: CanaryMetricConfig = ofNullable(
              this.props.canaryConfig.metrics.find(canaryMetricConfig =&gt; canaryMetricConfig.name === metricName)</div></div>
github benji6 / andromeda / client / scripts / components / molecules / InstrumentSelector.js View on Github external
{map(item =&gt;
        <option value="{item}">
          {capitalize(item)}
        </option>, instruments)}
github StormFireGame / game / src / components / hero / inventory / Items.js View on Github external
].map((item) => {
      const label = capitalize(item.replace('Give', ''));
      return renderItem(label, thing[item] > 0 ? `+${thing[item]}` : null);
    });

capitalize

capitalize the first letter of a string, or all words in a string

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular capitalize functions