How to use the inflection.titleize function in inflection

To help you get started, we’ve selected a few inflection 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 strongloop / loopback / lib / loopback.js View on Github external
if (params.model) {
                anotherClass = params.model;
            } else {
                var anotherClassName = i8n.singularize(anotherClass).toLowerCase();
                for(var name in this.schema.models) {
                    if (name.toLowerCase() === anotherClassName) {
                        anotherClass = this.schema.models[name];
                    }
                }
            }
        }
      
        var pluralized = i8n.pluralize(anotherClass.modelName);
        var methodName = params.as ||
            i8n.camelize(pluralized, true);
        var proxyMethodName = 'get' + i8n.titleize(pluralized, true);
    
        // create a proxy method
        var fn = this.prototype[proxyMethodName] = function () {
          // this[methodName] cannot be a shared method
          // because it is defined inside
          // a property getter...
        
          this[methodName].apply(thisClass, arguments);
        };
      
        fn.shared = true;
        fn.http = {verb: 'get', path: '/' + methodName};
        fn.accepts = {arg: 'where', type: 'object'};
        hasMany.apply(this, arguments);
      };
    }
github empiricaly / empirica / imports / core / api / lobby-configs / lobby-configs.js View on Github external
displayName() {
    if (this.name) {
      return this.name;
    }

    const type = inflection.titleize(this.timeoutType);
    const base = `${type}: ${this.timeoutInSeconds}s`;
    let details;
    switch (this.timeoutType) {
      case "lobby":
        details = `→ ${inflection.titleize(this.timeoutStrategy)}`;
        if (this.timeoutStrategy === "bots") {
          details += `(${this.timeoutBots.join(",")})`;
        }
        break;
      case "individual":
        details = `⨉ ${this.extendCount + 1}`;
        break;
      default:
        console.error(`unknown timeoutType: ${this.timeoutType}`);
        return base;
    }
github TypeCtrl / ngx-emoji-mart / scripts / build-data.ts View on Github external
emojiData.forEach((datum: any) => {
  const category = datum.category;
  const keywords = [];
  let categoryIndex;

  if (!datum.category) {
    throw new Error(`"${datum.short_name}" doesn’t have a category`);
  }

  if (!datum.name) {
    datum.name = datum.short_name.replace(/\-/g, ' ');
  }
  datum.name = inflection.titleize(datum.name || '');

  if (!datum.name) {
    throw new Error(`"${datum.short_name}" doesn’t have a name`);
  }

  datum.emoticons = datum.texts || [];
  datum.emoticons = datum.emoticons.map((x: string) => {
    if (x.endsWith('\\')) {
      return x + `\\`;
    }
    return x;
  });
  datum.text = datum.text || '';
  delete datum.texts;

  if (emojiLib.lib[datum.short_name]) {
github cube-js / cube.js / packages / cubejs-schema-compiler / scaffolding / ScaffoldingTemplate.js View on Github external
memberTitle(m) {
    return inflection.titleize(inflection.underscore(this.memberName(m))) !== m.title ? m.title : undefined;
  }
github jus / jus / lib / files / page.js View on Github external
setTitle () {
    this.title = this.title
      || this.$('title').text()
      || titlecase(this.path.name)
  },
github empiricaly / empirica / imports / core / ui / components / admin / AdminNewLobbyConfig.jsx View on Github external
{_.map(LobbyConfigs.timeoutStrategies, key => (
                        <option value="{key}">
                          {inflection.titleize(key)}
                        </option>
                      ))}
github ember-admin / ember-cli-admin / blueprints / tree-view-resource / index.js View on Github external
afterInstall: function(options) {
    var entityName = options.entity.name;
    var navigationStr = '\n  this.navigate("' + inflection.titleize(entityName) + '", { route: "' + entityName + '" });'
    var routerStr = '\n  this.resources("' + entityName + '");'

    var self = this;

    return this.insertIntoFile('app/navigation.js', navigationStr, {
      after: '});'
    }).then(function() {
      return self.insertIntoFile('app/router.js', routerStr, {
        after: 'MetaRoute.map(Router, function() {'
      });
    }).then(function() {
      self._writeStatusToUI(chalk.green, '[ember-cli-admin] add tree-view-resource', entityName);
    });
  }
};
github heroku / cli / packages / heroku-pipelines / lib / helpers.js View on Github external
function logKeyValue(key, value, maxKeyLength) {
  cli.log(inflection.titleize(key),':',' '.repeat(maxKeyLength - key.length),value);
}
github jus / jus / lib / files / page.js View on Github external
setTitle() {
    this.title = this.title
      || this.$('title').text()
      || titlecase(this.path.name)
  }