question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Irregular rule for unitOfMeasure to unitsOfMeasure does not work

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
fsmanuelcommented, Jan 18, 2016
'unitOfMeasure'.pluralize # => "unitOfMeasures"
'unitsOfMeasure'.singularize # => "unitsOfMeasure"
1reaction
stefanpennercommented, Jan 18, 2016

We aim todo whatever the rails inflector does, if someone wants to check we can decide if this is a bug or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

List of unusual units of measurement - Wikipedia
Many of the unusual units of measurements listed here are colloquial measurements, units devised to compare a measurement to common and familiar objects....
Read more >
Illegal unit of measure (pt inserted) - Overleaf
This lets LaTeX know that the image should be five centimetres wide. Using a unit which is not allowed in LaTeX: Another common...
Read more >
How Many Scruples in a Dram? - Merriam-Webster
As weights increase, a dram is 3 scruples, an ounce is 8 drams, ... This work was at a scale so small that...
Read more >
Problems with tense marking in children with specific ... - NCBI
First, there is clear evidence for problems with irregular as well as regular past tense in elicitation tasks.
Read more >
Conversion factor worksheet with answers
Law of Sines and Cosines Worksheet (This sheet is a summative worksheet that ... Details: A conversion factor is nothing, but the number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found