emberjs / ember-inflector

ember-inflector goal is to be rails compatible.
MIT License
106 stars 81 forks source link

Not able to define irregular, uncountable when imported directly #146

Closed jrjohnson closed 6 years ago

jrjohnson commented 6 years ago

I'm trying to replace my custom rules via direct import instead of through Ember. I have an initializer with

import Ember from 'ember';

export function initialize() {
  var inflector = Ember.Inflector.inflector;

  inflector.irregular('vocabulary', 'vocabularies');
  inflector.uncountable('aamc-pcrs');
}

export default {
  name: 'inflector',
  initialize
};

Attempting to update to using the module directly I tried to do

import { irregular, uncountable } from 'ember-inflector';

export function initialize() {
  irregular('vocabulary', 'vocabularies');
  uncountable('aamc-pcrs');
}

export default {
  name: 'inflector',
  initialize
};

But it results in TypeError: _emberInflector.irregular. Wondering if I'm just completely off base with my setup, or just missing something obvious? If someone can put me on the right path I will be happy to update the README with this information as I assume I'm not the only one defining strange words.

btecu commented 6 years ago

Try

import Inflector from 'ember-inflector';

Inflector.inflector.uncountable('aamc-pcrs');
jrjohnson commented 6 years ago

Thanks @btecu. So obvious in hindsight, but I would never have figured it out!