Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (params.model) {
anotherClass = params.model;
} else {
var anotherClassName = i8n.singularize(anotherClass).toLowerCase();
for(var name in this.schema.models) {
if (name.toLowerCase() === anotherClassName) {
anotherClass = this.schema.models[name];
}
}
}
}
var pluralized = i8n.pluralize(anotherClass.modelName);
var methodName = params.as ||
i8n.camelize(pluralized, true);
var proxyMethodName = 'get' + i8n.titleize(pluralized, true);
// create a proxy method
var fn = this.prototype[proxyMethodName] = function () {
// this[methodName] cannot be a shared method
// because it is defined inside
// a property getter...
this[methodName].apply(thisClass, arguments);
};
fn.shared = true;
fn.http = {verb: 'get', path: '/' + methodName};
fn.accepts = {arg: 'where', type: 'object'};
hasMany.apply(this, arguments);
};
}
displayName() {
if (this.name) {
return this.name;
}
const type = inflection.titleize(this.timeoutType);
const base = `${type}: ${this.timeoutInSeconds}s`;
let details;
switch (this.timeoutType) {
case "lobby":
details = `→ ${inflection.titleize(this.timeoutStrategy)}`;
if (this.timeoutStrategy === "bots") {
details += `(${this.timeoutBots.join(",")})`;
}
break;
case "individual":
details = `⨉ ${this.extendCount + 1}`;
break;
default:
console.error(`unknown timeoutType: ${this.timeoutType}`);
return base;
}
emojiData.forEach((datum: any) => {
const category = datum.category;
const keywords = [];
let categoryIndex;
if (!datum.category) {
throw new Error(`"${datum.short_name}" doesn’t have a category`);
}
if (!datum.name) {
datum.name = datum.short_name.replace(/\-/g, ' ');
}
datum.name = inflection.titleize(datum.name || '');
if (!datum.name) {
throw new Error(`"${datum.short_name}" doesn’t have a name`);
}
datum.emoticons = datum.texts || [];
datum.emoticons = datum.emoticons.map((x: string) => {
if (x.endsWith('\\')) {
return x + `\\`;
}
return x;
});
datum.text = datum.text || '';
delete datum.texts;
if (emojiLib.lib[datum.short_name]) {
memberTitle(m) {
return inflection.titleize(inflection.underscore(this.memberName(m))) !== m.title ? m.title : undefined;
}
setTitle () {
this.title = this.title
|| this.$('title').text()
|| titlecase(this.path.name)
},
{_.map(LobbyConfigs.timeoutStrategies, key => (
<option value="{key}">
{inflection.titleize(key)}
</option>
))}
afterInstall: function(options) {
var entityName = options.entity.name;
var navigationStr = '\n this.navigate("' + inflection.titleize(entityName) + '", { route: "' + entityName + '" });'
var routerStr = '\n this.resources("' + entityName + '");'
var self = this;
return this.insertIntoFile('app/navigation.js', navigationStr, {
after: '});'
}).then(function() {
return self.insertIntoFile('app/router.js', routerStr, {
after: 'MetaRoute.map(Router, function() {'
});
}).then(function() {
self._writeStatusToUI(chalk.green, '[ember-cli-admin] add tree-view-resource', entityName);
});
}
};
function logKeyValue(key, value, maxKeyLength) {
cli.log(inflection.titleize(key),':',' '.repeat(maxKeyLength - key.length),value);
}
setTitle() {
this.title = this.title
|| this.$('title').text()
|| titlecase(this.path.name)
}