DEV: Remove 'decamelize' string prototype extensions (#16747)

This commit is contained in:
Isaac Janzen 2022-05-13 11:32:19 -05:00 committed by GitHub
parent aa95a3d654
commit 839ae52c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* eslint-disable no-undef */ /* eslint-disable no-undef */
import { classify, dasherize } from "@ember/string"; import { classify, dasherize, decamelize } from "@ember/string";
import deprecated from "discourse-common/lib/deprecated"; import deprecated from "discourse-common/lib/deprecated";
import { findHelper } from "discourse-common/lib/helpers"; import { findHelper } from "discourse-common/lib/helpers";
import { get } from "@ember/object"; import { get } from "@ember/object";
@ -239,7 +239,7 @@ export function buildResolver(baseName) {
findTemplate(parsedName) { findTemplate(parsedName) {
const withoutType = parsedName.fullNameWithoutType, const withoutType = parsedName.fullNameWithoutType,
slashedType = withoutType.replace(/\./g, "/"), slashedType = withoutType.replace(/\./g, "/"),
decamelized = withoutType.decamelize(), decamelized = decamelize(withoutType),
dashed = decamelized.replace(/\./g, "-").replace(/\_/g, "-"), dashed = decamelized.replace(/\./g, "-").replace(/\_/g, "-"),
templates = Ember.TEMPLATES; templates = Ember.TEMPLATES;
@ -258,7 +258,7 @@ export function buildResolver(baseName) {
}, },
findUnderscoredTemplate(parsedName) { findUnderscoredTemplate(parsedName) {
let decamelized = parsedName.fullNameWithoutType.decamelize(); let decamelized = decamelize(parsedName.fullNameWithoutType);
let underscored = decamelized.replace(/\-/g, "_"); let underscored = decamelized.replace(/\-/g, "_");
return Ember.TEMPLATES[underscored]; return Ember.TEMPLATES[underscored];
}, },
@ -266,7 +266,7 @@ export function buildResolver(baseName) {
// Try to find a template within a special admin namespace, e.g. adminEmail => admin/templates/email // Try to find a template within a special admin namespace, e.g. adminEmail => admin/templates/email
// (similar to how discourse lays out templates) // (similar to how discourse lays out templates)
findAdminTemplate(parsedName) { findAdminTemplate(parsedName) {
let decamelized = parsedName.fullNameWithoutType.decamelize(); let decamelized = decamelize(parsedName.fullNameWithoutType);
if (decamelized.indexOf("components") === 0) { if (decamelized.indexOf("components") === 0) {
let comPath = `admin/templates/${decamelized}`; let comPath = `admin/templates/${decamelized}`;
const compTemplate = const compTemplate =