How to use the ember-runtime.String.classify function in ember-runtime

To help you get started, we’ve selected a few ember-runtime 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 emberjs / ember.js / packages / ember-application / lib / system / resolver.js View on Github external
let lastSlashIndex = name.lastIndexOf('/');
    let dirname = lastSlashIndex !== -1 ? name.slice(0, lastSlashIndex) : null;

    if (type !== 'template' && lastSlashIndex !== -1) {
      let parts = name.split('/');
      name = parts[parts.length - 1];
      let namespaceName = StringUtils.capitalize(parts.slice(0, -1).join('.'));
      root = Namespace.byName(namespaceName);

      assert(
        `You are looking for a ${name} ${type} in the ${namespaceName} namespace, but the namespace could not be found`,
        root
      );
    }

    let resolveMethodName = fullNameWithoutType === 'main' ? 'Main' : StringUtils.classify(type);

    if (!(name && type)) {
      throw new TypeError(`Invalid fullName: \`${fullName}\`, must be of the form \`type:name\` `);
    }

    return {
      fullName,
      type,
      fullNameWithoutType,
      dirname,
      name,
      root,
      resolveMethodName: `resolve${resolveMethodName}`
    };
  }
github emberjs / ember.js / packages / ember-application / lib / system / resolver.js View on Github external
resolveOther(parsedName) {
    let className = StringUtils.classify(parsedName.name) + StringUtils.classify(parsedName.type);
    let factory = get(parsedName.root, className);
    return factory;
  }
github emberjs / ember.js / packages / ember-application / lib / system / resolver.js View on Github external
translateToContainerFullname(type, name) {
    let suffix = StringUtils.classify(type);
    let namePrefix = name.slice(0, suffix.length * -1);
    let dasherizedName = StringUtils.dasherize(namePrefix);

    return `${type}:${dasherizedName}`;
  }
}
github emberjs / ember.js / packages / ember-application / lib / system / resolver.js View on Github external
resolveModel(parsedName) {
    let className = StringUtils.classify(parsedName.name);
    let factory = get(parsedName.root, className);

    return factory;
  }
  /**
github emberjs / ember.js / packages / ember-application / lib / system / resolver.js View on Github external
lookupDescription(fullName) {
    let parsedName = this.parseName(fullName);
    let description;

    if (parsedName.type === 'template') {
      return `template at ${parsedName.fullNameWithoutType.replace(/\./g, '/')}`;
    }

    description = `${parsedName.root}.${StringUtils.classify(parsedName.name).replace(/\./g, '')}`;

    if (parsedName.type !== 'model') {
      description += StringUtils.classify(parsedName.type);
    }

    return description;
  }