How to use the ember-runtime.String.capitalize 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
_parseName(fullName) {
    let [ type, fullNameWithoutType ] = fullName.split(':');

    let name = fullNameWithoutType;
    let namespace = get(this, 'namespace');
    let root = namespace;
    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,