How to use the @ember/string.camelize 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 HospitalRun / hospitalrun-frontend / app / mixins / navigation.js View on Github external
return navItems.map((nav) => {
      let sectionKey = localizationPrefix + camelize(nav.title).toLowerCase();
      let navTranslated = intl.t(sectionKey);

      set(nav, 'localizedTitle', navTranslated);
      // Map all of the sub navs, too
      set(nav, 'subnav', nav.subnav.map((sub) => {
        let subItemKey = `${localizationPrefix}subnav.${camelize(sub.title)}`;
        let subTranslated = intl.t(subItemKey);
        set(sub, 'localizedTitle', subTranslated);
        return sub;
      }));

      return nav;
    });
  }),
github cardstack / cardstack / packages / test-support / addon-test-support / test-helpers.js View on Github external
function getFieldEditorSectionElement(name) {
  return find(`[data-test-field-name="${camelize(name)}"]`);
}
github alphasights / ember-scrollable / addon / classes / scrollable.js View on Github external
contentOuterSize() {
    return this.contentElement[camelize(`outer-${this.sizeAttr}`)]();
  }
github cardstack / cardstack / packages / rendering / addon / -private / meta-for-field.js View on Github external
export default function metaForField(content, fieldName) {
  if (!content) {
    return;
  }

  fieldName = camelize(fieldName);
  try {
    return content.constructor.metaForProperty(fieldName);
  } catch (err) {
    return;
  }
}
github CenterForOpenScience / ember-osf-web / lib / osf-components / addon / components / files / manager / component.ts View on Github external
get displayedItems() {
        if (!this.currentFolder) {
            return [];
        }

        let sortedItems: File[] = this.currentFolder.files.toArray();

        if (this.sort) {
            const regex = /^(-?)([-\w]+)/;
            const groups = regex.exec(this.sort)!;

            groups.shift();
            const [reverse, sortKey] = groups.slice(0, 2);

            sortedItems = sortedItems.sortBy(camelize(sortKey));

            if (reverse) {
                sortedItems = sortedItems.reverse();
            }
            sortedItems = sortedItems.slice(0, this.maxFilesDisplayed);
        }

        return [
            ...this.lastUploaded,
            ...sortedItems.filter(item => !this.lastUploaded.includes(item)),
        ];
    }
github firebase / emberfire / addon / adapters / realtime-database.ts View on Github external
const collectionNameForType = (type: any) =>  pluralize(camelize(typeof(type) === 'string' ? type : type.modelName));
export const rootCollection = (adapter: RealtimeDatabaseAdapter, type: any) => databaseInstance(adapter).then(database => database.ref([get(adapter, 'namespace'), collectionNameForType(type)].join('/')));
github Vestorly / torii / addon / lib / query-string.js View on Github external
function getParamValue(obj, paramName, optional){
  var camelizedName = camelize(paramName),
      value         = get(obj, camelizedName);

  if (!optional) {
    if ( !isValue(value) && isValue(get(obj, paramName))) {
      throw new Error(
        'Use camelized versions of url params. (Did not find ' +
        '"' + camelizedName + '" property but did find ' +
        '"' + paramName + '".');
    }

    if (!isValue(value)) {
      throw new Error(
        'Missing url param: "'+paramName+'". (Looked for: property named "' +
        camelizedName + '".'
      );
    }
github TryGhost / Ghost-Admin / app / components / modal-webhook-form.js View on Github external
error.payload.errors.forEach((error) => {
                    let {message, property = ''} = error;
                    property = camelize(property);

                    if (property && attrs.includes(property)) {
                        this.webhook.errors.add(property, message);
                        this.webhook.hasValidated.pushObject(property);
                    } else {
                        this.set('error', `Error: ${message}`);
                    }
                });
github CenterForOpenScience / ember-osf-web / app / home / -components / hero-banner / component.ts View on Github external
import { serviceLinks } from 'ember-osf-web/const/service-links';

import { layout } from 'ember-osf-web/decorators/component';

import styles from './styles';
import template from './template';

const { featureFlagNames: { ABTesting } } = config;

@layout(template, styles)
@tagName('')
export default class HomeHeroBanner extends Component {
    @service features!: Features;

    @alias(`features.${camelize(ABTesting.homePageHeroTextVersionB)}`)
    shouldShowVersionB!: boolean;

    @action
    search(query: string) {
        const { search } = serviceLinks;
        window.location.href = `${search}?q=${query}&page=1`;
    }
}

@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