Sha256: a8f36dfed76af249a09426a9c593e7f25e50bf4a26202112f46790a55cf8bb1b

Contents?: true

Size: 486 Bytes

Versions: 2

Compression:

Stored size: 486 Bytes

Contents

import { Cache } from 'ember-utils';
/*
  This diverges from `Ember.String.dasherize` so that`<XFoo />` can resolve to `x-foo`.
  `Ember.String.dasherize` would resolve it to `xfoo`..
*/
const SIMPLE_DASHERIZE_REGEXP = /[A-Z]/g;
const ALPHA = /[A-Za-z]/;
export default new Cache(1000, key => key.replace(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
    if (index === 0 || !ALPHA.test(key[index - 1])) {
        return char.toLowerCase();
    }
    return `-${char.toLowerCase()}`;
}));

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-template-compiler/lib/system/dasherize-component-name.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js