Expose helper behavior as an importable function
lukemelia opened this issue · 4 comments
I started using this library after a while of not using it and was surprised that I couldn't get similar output from
and
import { pluralize } from 'ember-inflector';
//...
return pluralize(2, 'cat'); // throws an exception
//...
Instead the function only accepts a single string argument.
There are obviously backwards-compatibility issues to worry about here. Perhaps we should export a pluralize
function from ember-inflector/lib/helpers/pluralize
that behaves like the helper (and same for singularize
)?
Happy to work on this if I get confirmation on the direction.
@lukemelia it may not be compatibility issue, as we would detect the arity and give the right behavior (or am I missing something)?
@stefanpenner that should work. I'll put this on my list.
This would be very useful.
Seems like #124 would make {{pluralize ...}}
and pluralize(...)
work in a similar way.
Any issues for not merging?
released as v2.2.0