How to use the inflected.tableize function in inflected

To help you get started, we’ve selected a few inflected 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 DefinitelyTyped / DefinitelyTyped / inflected / inflected-tests.ts View on Github external
import * as Inflector from "inflected";

Inflector.pluralize("Category");
Inflector.singularize("Categories");
Inflector.camelize("nerd_bar", false);
Inflector.underscore('FooBar')      // => 'foo_bar'
//Inflector.humanize('employee_salary')                   // => 'Employee salary'
//Inflector.humanize('author_id')                         // => 'Author'
Inflector.humanize('author_id', { capitalize: false })  // => 'author'

Inflector.titleize('man from the boondocks')   // => 'Man From The Boondocks'
Inflector.titleize('x-men: the last stand')    // => 'X Men: The Last Stand'
Inflector.titleize('TheManWithoutAPast')       // => 'The Man Without A Past'
Inflector.titleize('raiders_of_the_lost_ark')  // => 'Raiders Of The Lost Ark'

Inflector.tableize('RawScaledScorer')  // => 'raw_scaled_scorers'
Inflector.tableize('egg_and_ham')      // => 'egg_and_hams'
Inflector.tableize('fancyCategory')    // => 'fancy_categories'

Inflector.classify('egg_and_hams')  // => 'EggAndHam'
Inflector.classify('posts')         // => 'Post'

Inflector.dasherize('puni_puni')  // => 'puni-puni'

Inflector.foreignKey('Message')         // => 'message_id'
Inflector.foreignKey('Message', false)  // => 'messageid'

Inflector.ordinal(1)      // => 'st'
Inflector.ordinal(2)      // => 'nd'
Inflector.ordinal(1002)   // => 'nd'
Inflector.ordinal(1003)   // => 'rd'
Inflector.ordinal(-11)    // => 'th'
github DefinitelyTyped / DefinitelyTyped / inflected / inflected-tests.ts View on Github external
Inflector.pluralize("Category");
Inflector.singularize("Categories");
Inflector.camelize("nerd_bar", false);
Inflector.underscore('FooBar')      // => 'foo_bar'
//Inflector.humanize('employee_salary')                   // => 'Employee salary'
//Inflector.humanize('author_id')                         // => 'Author'
Inflector.humanize('author_id', { capitalize: false })  // => 'author'

Inflector.titleize('man from the boondocks')   // => 'Man From The Boondocks'
Inflector.titleize('x-men: the last stand')    // => 'X Men: The Last Stand'
Inflector.titleize('TheManWithoutAPast')       // => 'The Man Without A Past'
Inflector.titleize('raiders_of_the_lost_ark')  // => 'Raiders Of The Lost Ark'

Inflector.tableize('RawScaledScorer')  // => 'raw_scaled_scorers'
Inflector.tableize('egg_and_ham')      // => 'egg_and_hams'
Inflector.tableize('fancyCategory')    // => 'fancy_categories'

Inflector.classify('egg_and_hams')  // => 'EggAndHam'
Inflector.classify('posts')         // => 'Post'

Inflector.dasherize('puni_puni')  // => 'puni-puni'

Inflector.foreignKey('Message')         // => 'message_id'
Inflector.foreignKey('Message', false)  // => 'messageid'

Inflector.ordinal(1)      // => 'st'
Inflector.ordinal(2)      // => 'nd'
Inflector.ordinal(1002)   // => 'nd'
Inflector.ordinal(1003)   // => 'rd'
Inflector.ordinal(-11)    // => 'th'
Inflector.ordinal(-1021)  // => 'st'
github DefinitelyTyped / DefinitelyTyped / inflected / inflected-tests.ts View on Github external
Inflector.pluralize("Category");
Inflector.singularize("Categories");
Inflector.camelize("nerd_bar", false);
Inflector.underscore('FooBar')      // => 'foo_bar'
//Inflector.humanize('employee_salary')                   // => 'Employee salary'
//Inflector.humanize('author_id')                         // => 'Author'
Inflector.humanize('author_id', { capitalize: false })  // => 'author'

Inflector.titleize('man from the boondocks')   // => 'Man From The Boondocks'
Inflector.titleize('x-men: the last stand')    // => 'X Men: The Last Stand'
Inflector.titleize('TheManWithoutAPast')       // => 'The Man Without A Past'
Inflector.titleize('raiders_of_the_lost_ark')  // => 'Raiders Of The Lost Ark'

Inflector.tableize('RawScaledScorer')  // => 'raw_scaled_scorers'
Inflector.tableize('egg_and_ham')      // => 'egg_and_hams'
Inflector.tableize('fancyCategory')    // => 'fancy_categories'

Inflector.classify('egg_and_hams')  // => 'EggAndHam'
Inflector.classify('posts')         // => 'Post'

Inflector.dasherize('puni_puni')  // => 'puni-puni'

Inflector.foreignKey('Message')         // => 'message_id'
Inflector.foreignKey('Message', false)  // => 'messageid'

Inflector.ordinal(1)      // => 'st'
Inflector.ordinal(2)      // => 'nd'
Inflector.ordinal(1002)   // => 'nd'
Inflector.ordinal(1003)   // => 'rd'
Inflector.ordinal(-11)    // => 'th'
Inflector.ordinal(-1021)  // => 'st'
github sdelrio0 / pyrope / lib / models.js View on Github external
prevPromise.then(() => {
                          // todo: refactor with batchWrite ?
                          const destroyAction = new PyropeActions({tablePrefix: this.tablePrefix, tableName: Inflector.tableize(currKey), tableSuffix: this.tableSuffix});
                          
                          return destroyAction.destroy({
                            index: {uuid: currAssoc}
                          })
                        })
github sdelrio0 / pyrope / lib / models.js View on Github external
constructor(schema, opts = {}) {
    if(!schema) throw new Error(`PyropeModel#constructor(): 'schema' is undefined.`);
    if(!schema.name) throw new Error(`PyropeModel#constructor(): 'schema.name' is undefined.`);
    if(!schema._typeConfig.fields) throw new Error(`PyropeModel#constructor(): 'schema.fields' is undefined.`);
    
    this.name = opts.name || schema.name;
    this.humanName = Inflector.humanize(this.name);
    this.fields = schema._typeConfig.fields();
    this.defaultQueryKey = 'uuid';  // opts.defaultQueryKey || 'uuid'; // todo: implement defaultQueryKey
    this.validations = opts.validations;
    
    this.tablePrefix = opts.tablePrefix || '';
    this.tableSuffix = opts.tableSuffix || '';
    this.tableName = opts.tableName || Inflector.tableize(schema.name);
    this.fullTableName = this.tablePrefix + this.tableName + this.tableSuffix;
    
    this.actions = new PyropeActions({tablePrefix: this.tablePrefix, tableName: this.tableName, tableSuffix: this.tableSuffix})
  }
github sdelrio0 / pyrope / lib / utils.js View on Github external
  return sortBy([modelName, associationKey].map(t => Inflector.tableize(t)), t => t).join('_');
};
github capejs / capejs / lib / cape / collection_agent.js View on Github external
refreshObjects(data) {
    let paramName = this.paramName || Inflector.tableize(this.resourceName)

    this.objects.length = 0
    if (typeof data === 'object' && Array.isArray(data[paramName])) {
      for (let i = 0; i < data[paramName].length; i++) {
        this.objects.push(data[paramName][i])
      }
    }
  }
github capejs / capejs / dist / cape.js View on Github external
refreshObjects: function(data) {
    var paramName = this.options.paramName ||
      Inflector.tableize(this.resourceName);

    this.objects.length = 0;
    if (typeof data === 'object' && Array.isArray(data[paramName])) {
      for (var i = 0; i < data[paramName].length; i++) {
       this.objects.push(data[paramName][i]);
      }
    }
  },