How to use pluralize.isPlural:
363 364 365 366 367 368 369 370 371 372
var strategy = self.context.getConfiguration().getStrategy(DataConfigurationStrategy); self.fields.forEach(function(x) { if (typeof x.many === 'undefined') { if (typeof strategy.dataTypes[x.type] === 'undefined') //set one-to-many attribute (based on a naming convention) x.many = pluralize.isPlural(x.name) || (x.mapping && x.mapping.associationType === 'junction'); else //otherwise set one-to-many attribute to false x.many = false; }
How to use pluralize.isSingular:
104 105 106 107 108 109 110 111 112 113
{ // type of pikachu what is the type of pikachu -> this one // name of pikachu what is the name of pikachu -> properties // types of job what are the types of animals -> next one notes: 'type of pikachu', // the types of type is the next one match: ({context}) => context.marker == 'type' && context.evaluate && context.object && context.objects[context.objects.length-1].number == 'one' && pluralize.isSingular(context.objects[0].word), apply: ({context, objects, gs, km, log, s}) => { const concept = context.objects[0]; const value = context.objects[1]; let instance = km('dialogues').api.evaluate(value, context, log, s)
How to use pluralize.plural:
2506 2507 2508 2509 2510 2511 2512 2513 2514 2515
//if associated model has only one field with type equal to this model if (testFields.length === 1) { //create a regular expression that is going to be used to test // if field name is equal to the pluralized string of associated model name // e.g. orders -> Order var reTestFieldName = new RegExp('^' + pluralize.plural(associatedModel.name) + '$', 'ig'); //create a regular expression to test // if the name of the associated field is equal to this model name // e.g. Person model has a field named user with type User var reTestName = new RegExp('^' + self.name + '$','ig');
How to use pluralize.singular:
218 219 220 221 222 223 224 225 226
this.copyHandleBarsTemplate('routes/route.hbs', routesPath, { modelName: this.getModelNameFromTableName(modelName), modelNameDasherized, modelNameReadablePlural: plural(readableModelName), modelNameReadableSingular: singular(readableModelName), isMongoDB: dbDialect === 'mongodb', }); }
2
51
10
See more examples