How to use the @ember/string.classify function in @ember/string

To help you get started, we’ve selected a few @ember/string 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 discourse / discourse / app / assets / javascripts / discourse-common / addon / resolver.js View on Github external
function parseName(fullName) {
  const nameParts = fullName.split(":");
  const type = nameParts[0];
  let fullNameWithoutType = nameParts[1];
  const namespace = get(this, "namespace");
  const root = namespace;

  return {
    fullName,
    type,
    fullNameWithoutType,
    name: fullNameWithoutType,
    root,
    resolveMethodName: "resolve" + classify(type),
  };
}
github izelnakri / mber / lib / addons / memserver / instance-initializers / memserver.js View on Github external
const modelFixtureTree = APP_MODULES.reduce((result, moduleReference) => {
    if (/\/memserver\/fixtures/g.test(moduleReference)) {
      const modelName = classify(singularize(moduleReference.split('/').slice(-1)[0]));
      const fixtures = require(moduleReference, null, null, true).default;

      if (!fixtures) {
        throw new Error(`[MemServer] ${moduleReference} cannot be loaded, please check if you are exporting an array!`)
      }

      result[modelName] = Object.assign(result[modelName] || {}, { fixtures: fixtures });
    } else if (/\/memserver\/models/g.test(moduleReference)) {
      const modelName = classify(moduleReference.split('/').slice(-1)[0]);
      const model = require(moduleReference, null, null, true).default;

      if (!model) {
        throw new Error(`[MemServer] ${moduleReference} cannot be loaded, please check if you are the model correctly!`)
      }

      result[modelName] = Object.assign(result[modelName] || {}, { model: model });
    }

    return result;
  }, {});
github smile-io / ember-polaris / addon / components / polaris-display-text.js View on Github external
sizeClassName: computed('size', function() {
    const size = this.get('size');
    return `Polaris-DisplayText--size${classify(size)}`;
  }).readOnly(),
});
github smile-io / ember-polaris / addon / components / polaris-drop-zone / file-upload.js View on Github external
imageClasses: computed('size', function() {
    let classes = ['Polaris-DropZone-FileUpload__Image'];
    let size = this.get('size');
    if (['extraLarge', 'large'].includes(size)) {
      classes.push(`Polaris-DropZone-FileUpload--size${classify(size)}`);
    }

    return classes.join(' ');
  }).readOnly(),
});
github ember-learn / ember-cli-addon-docs / addon / components / docs-header / component.js View on Github external
export default Component.extend({
  layout,
  tagName: '',

  projectVersion: service(),

  projectHref,
  latestVersionName,

  didInsertElement() {
    this._super(...arguments);

    this.get('projectVersion').loadAvailableVersions();
  },

  logo: classify(addonLogo(projectName)),

  /**
    The prefix of your project, typically "Ember", "EmberCLI" or "EmberData".

    By default the prefix will be autodiscovered from the `name` field of your addon's package.json.

    ```hbs
    {{docs-header prefix='EmberData'}}
    ```

    @argument prefix
    @type String?
  */
  prefix: addonPrefix(projectName),

  /**
github smile-io / ember-polaris / addon / components / polaris-drop-zone / file-upload.js View on Github external
actionHint: computed('type', function() {
    let type = this.get('type');
    return fileUploadStrings[`actionHint${classify(type)}`];
  }),
github smile-io / ember-polaris / addon / components / polaris-avatar.js View on Github external
styleClass: computed('nameString', function() {
    let nameString = this.get('nameString');
    let styleIndex = isEmpty(nameString)
      ? 0
      : nameString.charCodeAt(0) % styleClasses.length;
    let style = styleClasses[styleIndex];

    return `Polaris-Avatar--style${classify(style)}`;
  }).readOnly(),
github freshbooks / ember-responsive / addon / services / media.js View on Github external
Object.keys(breakpoints).forEach((name) => {
        const cpName = `is${classify(name)}`;
        defineProperty(this, cpName, computed('matches.[]', function () {
          return this.get('matches').indexOf(name) > -1;
        }));
        defineProperty(this, name, computed(cpName, function () {
          return this.get(cpName);
        }));
        this.match(name, breakpoints[name]);
      });
    }
github smile-io / ember-polaris / addon / components / polaris-stack.js View on Github external
spacingClassName: computed('spacing', function() {
    const spacing = this.get('spacing');
    if (isBlank(spacing)) {
      return null;
    }

    return `Polaris-Stack--spacing${classify(spacing)}`;
  }).readOnly(),
github mike-north / ember-resize / addon / services / resize.ts View on Github external
Object.keys(defaults).map((key: keyof ResizeDefaults) => {
      const classifiedKey = classify(key);
      const defaultKey = `default${classifiedKey}`;
      return set(this as any, defaultKey, defaults[key]);
    });
  }

@ember/string

A set of utilities to transform strings

MIT
Latest version published 5 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages