Skip to content

Irregular rule for unitOfMeasure to unitsOfMeasure does not work #95

@adam-knights

Description

@adam-knights

I tried adding

inflector.irregular('unitOfMeasure', 'unitsOfMeasure');

To my app and it doesn't work, it hits /api/unitOfMeasure, it should now be hitting /api/unitsOfMeasure

I created a unit test in /tests/unit/inflector-test.js that fails on both asserts in latest master:

test('unit of measure', function(assert) {
  inflector.irregular('unitOfMeasure', 'unitsOfMeasure');

  assert.equal(inflector.singularize('unitsOfMeasure'), 'unitOfMeasure', 'irregular singularization rule was applied');
  assert.equal(inflector.pluralize('unitOfMeasure'), 'unitsOfMeasure', 'irregular pluralization rule was applied');
});

I had a quick debug, it seems to find the irregular rule ok and populate substitution in the for loop, but then I think the return in that loop of return word.replace(rule, substitution); doesn't do the job as word is unitOfMeasure and rule is unitofmeasure, so there is no match due to the casing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions