So I was going through [ngPluralize](https://docs.angularjs.org/api/ng/directive/ngPluralize) directive example which is exactly what I needed, but I was wondering if its possible to convert this into a Javascript function in an ng factory service. 

The function in ng service would just remove the logic from html and reduce number of lines of code if I had a service where I can pass string and the service can check if the string is plural or singular.

here is what I want to convert into a function in ng service:

```
 <ng-pluralize count="numberOfCars" 
      when="{'0':'0 Cars',
             '1': '1 Car',
             '2': '2 Cars',
             'other': '{} Cars'
      }">

```