How to use the inflected.camelize 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 ForestAdmin / forest-express-mongoose / routes / associations.js View on Github external
function getAssociationModel(associationName) {
    var schema = Schemas.schemas[model.collection.name];
    var field = _.findWhere(schema.fields, { field: associationName });
    if (field && field.reference) {
      var referenceName = field.reference.split('.')[0];
      return Inflector.camelize(Inflector.singularize(referenceName));
    }
  }
github hopsoft / stimulus_reflex / javascript / stimulus_reflex.js View on Github external
controllers.forEach(controller => {
    const reflexMethodName = reflex.split('#')[1]

    const specificLifecycleMethodName = ['before', 'after'].includes(stage)
      ? `${stage}${camelize(reflexMethodName)}`
      : `${camelize(reflexMethodName, false)}${camelize(stage)}`
    const specificLifecycleMethod = controller[specificLifecycleMethodName]

    const genericLifecycleMethodName = ['before', 'after'].includes(stage)
      ? `${stage}Reflex`
      : `reflex${camelize(stage)}`
    const genericLifecycleMethod = controller[genericLifecycleMethodName]

    if (typeof specificLifecycleMethod === 'function') {
      setTimeout(
        () =>
          specificLifecycleMethod.call(
            controller,
            element,
            reflex,
            element.reflexError
          ),
        1
      )
    }

    if (typeof genericLifecycleMethod === 'function') {
github cowboyd / mirage-server / lib / serializer.js View on Github external
keyForModel(modelName) {
    return camelize(modelName);
  }
github cowboyd / mirage-server / lib / serializer.js View on Github external
keyForPolymorphicForeignKeyType(relationshipName) {
    return `${camelize(relationshipName)}Type`;
  }
github cowboyd / mirage-server / lib / route-handlers / base.js View on Github external
Object.keys(json.data.relationships).forEach((key) => {
        let relationship = json.data.relationships[key];

        if (Array.isArray(relationship.data)) {
          attrs[`${camelize(singularize(key))}Ids`] = relationship.data.map(rel => rel.id);
        } else {
          attrs[`${camelize(key)}Id`] = relationship.data && relationship.data.id;
        }
      }, {});
    }
github cowboyd / mirage-server / lib / orm / schema.js View on Github external
modelClassFor(modelName) {
    return this._registry[camelize(modelName)].class.prototype;
  }
github cowboyd / mirage-server / lib / route-handlers / shorthands / head.js View on Github external
handleStringShorthand(request, modelClass) {
    let modelName = this.shorthand;
    let camelizedModelName = camelize(modelName);

    assert(
      modelClass,
      `The route handler for ${request.url} is trying to access the ${camelizedModelName} model, but that model doesn't exist. Create it using 'ember g mirage-model ${modelName}'.`
    );

    let id = this._getIdForRequest(request);
    if (id) {
      let model = modelClass.find(id);
      if (!model) {
        return new Response(404);
      } else {
        return new Response(204);
      }
    } else if (this.options.coalesce && request.queryParams && request.queryParams.ids) {
      let model = modelClass.find(request.queryParams.ids);
github cowboyd / mirage-server / lib / orm / schema.js View on Github external
_modelFor(modelName) {
    return this._registry[camelize(modelName)].class;
  }
github croquiscom / cormo / packages / cormo / src / util / inflector.ts View on Github external
export function camelize(str: string): string {
  return inflected.camelize(str);
}