ember-inflector: Irregular rule for unitOfMeasure to unitsOfMeasure does not work
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?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 18 (9 by maintainers)
We aim todo whatever the rails inflector does, if someone wants to check we can decide if this is a bug or not.