How to use the inflection.classify 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 ozum / pg-structure / bin / js2md.js View on Github external
getFiles(__dirname + '/../lib', function(err, dir, file) {
    let jsFileBase  = path.basename(file, path.extname(file));                      // Ex: m2o-relation, column etc.
    let title       = conversion[jsFileBase] || inflection.titleize(jsFileBase);    // Ex: M2O Relation, Column etc.
    let base        = inflection.classify(title.replace(/\s/g, ''));                // Ex: M2ORelation, Column etc.

    if (dir.match(/util$/) || path.extname(file) !== '.js') return; // Skip util directory and non js files.

    // Add page to YAML config.
    let configLine = {};
    configLine[title] = path.join('api', `${base}.md`);
    apiPagesConfig.push(configLine);

    let source = path.join(dir, file);
    let target = path.join(mdBase, 'api', `${base}.md`);

    exec(`jsdoc2md ${source} > ${target}`, puts);
});
github dreamerslab / coke / lib / cli / generators / view.js View on Github external
args.forEach( function ( arg ){
      var tmp   = lib.valid_model_prop_name( arg ).split( ':' );
      var prop  = tmp[ 0 ];
      var title = inflection.classify( prop );

      code = self._html_show_partial( code, singular, title, prop );
    });
github keystonejs / keystone / packages / fields / src / types / Select / Implementation.js View on Github external
getTypeName() {
    return `${this.listKey}${inflection.classify(this.path)}Type`;
  }
  getGqlAuxTypes() {
github wxs77577 / adonis-rest / src / Models / Model.js View on Github external
async fetchOptionData (fieldName) {
    const { resource, text, value = '_id' } = this.constructor.fields[fieldName].ajaxOptions
    const modelName = inflection.classify(resource)
    const ret = await use(`App/Models/${modelName}`).fetchOptions(value, text, {
      _id: { $in: this[fieldName] }
    }, 1000)
    return ret
  }
github kaspernj / api_maker / npm-api-maker / src / models-response-reader.js View on Github external
models() {
    const preloaded = new Preloaded(this.response)
    const models = []

    for(const modelType in this.response.data) {
      const modelClassName = inflection.classify(modelType.replace(/-/g, "_"))
      const modelClass = digg(require("api-maker/models"), modelClassName)
      const collectionName = inflection.dasherize(modelClass.modelClassData().collectionName)

      for(const modelId of this.response.data[modelType]) {
        const modelData = this.response.preloaded[collectionName][modelId]

        if (!modelData)
          throw new Error(`Couldn't find model data for ${collectionName}(${modelId})`)

        const model = new modelClass({
          collection: this.collection,
          data: modelData,
          isNewRecord: false
        })

        model._readPreloadedRelationships(preloaded)
github kaspernj / api_maker / npm-api-maker / src / preloaded.js View on Github external
loadPreloadedModels() {
    this.preloaded = {}

    for(const preloadedType in this.response.preloaded) {
      const modelClassName = inflection.classify(preloadedType.replace(/-/g, "_"))
      const modelClass = digg(require("api-maker/models"), modelClassName)

      for(const preloadedId in this.response.preloaded[preloadedType]) {
        const preloadedData = this.response.preloaded[preloadedType][preloadedId]
        const model = new modelClass({data: preloadedData, isNewRecord: false})

        if (!this.preloaded[preloadedType])
          this.preloaded[preloadedType] = {}

        this.preloaded[preloadedType][preloadedId] = model
      }
    }

    for(const modelType in this.preloaded) {
      for(const modelId in this.preloaded[modelType]) {
        this.preloaded[modelType][modelId]._readPreloadedRelationships(this)
github luin / CodeGame / models / index.js View on Github external
Object.keys(models).forEach(function(key) {
  if (key === 'index') {
    return;
  }
  var modelName = inflection.classify(key);
  var modelInstance = sequelize.import(modelName , function(sequelize, DataTypes) {
    var definition = [modelName].concat(models[key](DataTypes));
    return sequelize.define.apply(sequelize, definition);
  });
  self[modelName] = modelInstance;
});
github dreamerslab / coke / lib / cli / generators / lib.js View on Github external
valid_model_name : function ( model ){
    return inflection.classify( _.valid_name( model, regex.has_none_characters ));
  },