diff --git a/packages/ember-runtime/lib/system/string.js b/packages/ember-runtime/lib/system/string.js index 87122528c39..7d5c4986740 100644 --- a/packages/ember-runtime/lib/system/string.js +++ b/packages/ember-runtime/lib/system/string.js @@ -16,44 +16,50 @@ var STRING_DASHERIZE_CACHE = new Cache(1000, function(key) { return decamelize(key).replace(STRING_DASHERIZE_REGEXP, '-'); }); +var STRING_CAMELIZE_REGEXP_1 = (/(\-|\_|\.|\s)+(.)?/g); +var STRING_CAMELIZE_REGEXP_2 = (/(^|\/)([A-Z])/g); + var CAMELIZE_CACHE = new Cache(1000, function(key) { - return key.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) { + return key.replace(STRING_CAMELIZE_REGEXP_1, function(match, separator, chr) { return chr ? chr.toUpperCase() : ''; - }).replace(/^([A-Z])/, function(match, separator, chr) { + }).replace(STRING_CAMELIZE_REGEXP_2, function(match, separator, chr) { return match.toLowerCase(); }); }); -var CLASSIFY_CACHE = new Cache(1000, function(str) { - var parts = str.split("."); - var out = []; +var STRING_CLASSIFY_REGEXP_1 = (/(\-|\_|\.|\s)+(.)?/g); +var STRING_CLASSIFY_REGEXP_2 = (/(^|\/|\.)([a-z])/g); - for (var i=0, l=parts.length; i