How to use the pluralize.plural function in pluralize

To help you get started, we’ve selected a few pluralize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bradleyboy / tuql / src / builders / associations.js View on Github external
.forEach(column => {
      const root = column.name.replace(FK_SUFFIX_REGEX, '');

      associations.push({
        from: plural(root),
        to: table,
        type: 'hasMany',
        options: {
          foreignKey: formatFieldName(column.name),
        },
      });

      associations.push({
        from: table,
        to: plural(root),
        type: 'belongsTo',
        options: {
          foreignKey: formatFieldName(column.name),
        },
      });
    });
github trekjs / route-mapper / src / SingletonResource.js View on Github external
get plural() {
    return pluralize.plural(this.name)
  }
github aws-amplify / amplify-cli / packages / amplify-codegen-appsync-model-plugin / src / visitors / appsync-visitor.ts View on Github external
protected pluralizeModelName(model: CodeGenModel): string {
    return plural(model.name);
  }
github danielmahon / opencrud-admin / src / providers / RemoteConfigProvider.js View on Github external
requiredMutations.forEach(method => {
        let resourceType = model.type;
        if (method.includes('Many')) {
          resourceType = plural(resourceType);
        }
        if (!remote.mutation[`${method}${resourceType}`]) {
          throw new Error(
            `Missing ${method}${resourceType} mutation in remote schema!`
          );
        }
      });
    });
github HeskeyBaozi / umi-plugin-mobx / lib / index.js View on Github external
function transformWord(word, toSingular) {
    if (pluralize.isPlural(word)) {
        return toSingular ? pluralize.singular(word) : word;
    }
    else {
        return toSingular ? word : pluralize.plural(word);
    }
}
function optsToArray(item) {
github SchizoDuckie / CreateReadUpdateDelete.js / cli / entitybuilder.js View on Github external
function createConnectorEntity(targetEntity, type) {
        switch (type) {
            case 'many:many':

                var rels = {},
                    properties = {};
                relation = CRUD.entities[targetEntity];

                rels[entity.name] = 'many:1\n';
                rels[targetEntity] = '1:many\n';

                var primaryA = relation.primary;
                var primaryB = entity.primary;
                properties[primaryA] = properties[primaryB] = int11;
                var connector = {
                    table: pluralize.plural(entity.name) + '_' + pluralize.plural(targetEntity),
                    name: entity.name + '_' + targetEntity,
                    primary: 'ID_' + entity.name + '_' + targetEntity,
                    relations: rels,
                    properties: properties
                };
                return outputEntity(connector, true);
        }
        return targetEntity;
    }
github pedsmoreira / battlecry / src / helpers / namedCasex.js View on Github external
export function applyPluralization(name: string, match: string) {
  if (match.startsWith('__')) return name;

  const isPlural = match.endsWith('s');
  return isPlural ? pluralize.plural(name) : pluralize.singular(name);
}
github devonfw / devon4node / packages / schematics / src / lib / crud / crud.factory.ts View on Github external
export function crud(options: ICrudOptions): Rule {
  const name = strings.dasherize(basename(options.name as Path));
  const fullName = join(dirname(options.name as Path), pluralize.plural(name));
  const projectPath = options.path || '.';
  const path = normalize(join(projectPath as Path, 'src/app', options.name, '..'));
  return chain([
    schematic('entity', options),
    mergeWith(
      apply(url('./files'), [
        template({
          ...strings,
          name,
          fullName,
        }),
        formatTsFiles(),
        move(path),
      ]),
    ),
    updatePackageJson(projectPath),
github catesandrew / recipe-parser / lib / util.js View on Github external
util.altMeasurementTerms = _.union(_altMeasurementTerms, _.map(_altMeasurementTerms, function(term) {
  return pluralize.plural(term);
})).sort();
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / src / resources.ts View on Github external
public makeSyncResolver(type: string, queryTypeName: string = 'Query') {
    const fieldName = graphqlName('sync' + toUpper(plural(type)));
    return new AppSync.Resolver({
      ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
      DataSourceName: Fn.GetAtt(ModelResourceIDs.ModelTableDataSourceID(type), 'Name'),
      FieldName: fieldName,
      TypeName: queryTypeName,
      RequestMappingTemplate: print(
        DynamoDBMappingTemplate.syncItem({
          filter: ifElse(ref('context.args.filter'), ref('util.transform.toDynamoDBFilterExpression($ctx.args.filter)'), nul()),
          limit: ref('util.defaultIfNull($ctx.args.limit, 100)'),
          lastSync: ref('util.toJson($util.defaultIfNull($ctx.args.lastSync, null))'),
          nextToken: ref('util.toJson($util.defaultIfNull($ctx.args.nextToken, null))'),
        })
      ),
      ResponseMappingTemplate: print(DynamoDBMappingTemplate.dynamoDBResponse()),
    });
  }