{"action":"created","issue":{"url":"https://api.github.com/repos/eemeli/make-plural.js/issues/8","labels_url":"https://api.github.com/repos/eemeli/make-plural.js/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/eemeli/make-plural.js/issues/8/comments","events_url":"https://api.github.com/repos/eemeli/make-plural.js/issues/8/events","html_url":"https://github.com/eemeli/make-plural.js/issues/8","id":69195532,"number":8,"title":"{ ordinals: true } option","user":{"login":"rxaviers","id":967155,"avatar_url":"https://avatars.githubusercontent.com/u/967155?v=3","gravatar_id":"","url":"https://api.github.com/users/rxaviers","html_url":"https://github.com/rxaviers","followers_url":"https://api.github.com/users/rxaviers/followers","following_url":"https://api.github.com/users/rxaviers/following{/other_user}","gists_url":"https://api.github.com/users/rxaviers/gists{/gist_id}","starred_url":"https://api.github.com/users/rxaviers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxaviers/subscriptions","organizations_url":"https://api.github.com/users/rxaviers/orgs","repos_url":"https://api.github.com/users/rxaviers/repos","events_url":"https://api.github.com/users/rxaviers/events{/privacy}","received_events_url":"https://api.github.com/users/rxaviers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-17T18:48:32Z","updated_at":"2015-04-18T16:49:47Z","closed_at":null,"body":"Hi @eemeli,\r\n\r\nDocumentation says\r\n\r\n> The optional `opt` parameter may contain the following boolean members:\r\n* `cardinals` — if true, rules for cardinal values (1 day, 2 days, etc.) are \r\n  included\r\n* `ordinals` — if true, rules for ordinal values (1st, 2nd, etc.) are included\r\n\r\n> If both `opt.ordinals` and `opt.cardinals` are true, the returned function takes\r\na second parameter `ord`. Then, if `ord` is true, the function will return the\r\nordinal rather than cardinal category applicable to `n` in locale `lc`.\r\n\r\nBy passing `{ordinals: true, cardinals: false}`, I expect that the \"function will return the\r\nordinal rather than cardinal\". But, currently the returned function also depends on the state of `MakePlural.cardinals` (https://github.com/eemeli/make-plural.js/blob/4a663fe3cae92c18e6e574ec5b63f9c70ba35f85/src/make-plural.js#L126-L127) (whether or not it has been set previously).\r\n\r\nI am wondering if we could change the API to make it more consistent. Some ideas:\r\n 1. Consider options only independently of MakePlural.cardinals or MakePlural.ordinals being set. [1]\r\n 1. Change options to allow something in this line `{provide: \"cardinal\"}`, `{provide: \"ordinal\"}`, or `{provide: \"both\"}`.\r\n\r\n1: \r\n```diff\r\n--- a/src/make-plural.js\r\n+++ b/src/make-plural.js\r\n@@ -123,8 +123,11 @@ export default class MakePlural {\r\n             lc = opt.lc;\r\n         }\r\n         this.lc = lc || MakePlural.lc;\r\n-        this.cardinals = opt.cardinals || MakePlural.cardinals;\r\n-        this.ordinals = opt.ordinals || MakePlural.ordinals;\r\n+        this.cardinals = opt.cardinals;\r\n+        this.ordinals = opt.ordinals;\r\n+        if (!this.ordinals && !this.cardinals) {\r\n+            this.cardinals = MakePlural.cardinals;\r\n+        }\r\n         if (!this.ordinals && !this.cardinals) throw new Error('At least one ty\r\n         this.categories = { cardinal: [], ordinal: [] };\r\n         this.parser = new Parser();\r\n```"},"comment":{"url":"https://api.github.com/repos/eemeli/make-plural.js/issues/comments/94180152","html_url":"https://github.com/eemeli/make-plural.js/issues/8#issuecomment-94180152","issue_url":"https://api.github.com/repos/eemeli/make-plural.js/issues/8","id":94180152,"user":{"login":"tniessen","id":3109072,"avatar_url":"https://avatars.githubusercontent.com/u/3109072?v=3","gravatar_id":"","url":"https://api.github.com/users/tniessen","html_url":"https://github.com/tniessen","followers_url":"https://api.github.com/users/tniessen/followers","following_url":"https://api.github.com/users/tniessen/following{/other_user}","gists_url":"https://api.github.com/users/tniessen/gists{/gist_id}","starred_url":"https://api.github.com/users/tniessen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tniessen/subscriptions","organizations_url":"https://api.github.com/users/tniessen/orgs","repos_url":"https://api.github.com/users/tniessen/repos","events_url":"https://api.github.com/users/tniessen/events{/privacy}","received_events_url":"https://api.github.com/users/tniessen/received_events","type":"User","site_admin":false},"created_at":"2015-04-18T16:49:47Z","updated_at":"2015-04-18T16:49:47Z","body":"@eemeli That depends on how you want it to work. The problem with your suggestion is that it is still not safe to pass `{ ordinals: true }`.\r\n\r\nAccording to the documentation, setting `ordinals` to `true` should enable rules for ordinal values. In fact, as `('cardinals' in opt) === false` and `MakePlural.cardinals === true`, it will actually contain both types of rules. In my opinion, it is not very intuitive to specify `{ ordinals: true, cardinals: false }`. It should not be necessary to explicitly disable something you never enabled.\r\n\r\nAdditionally, there is no guarantee that `{ ordinals: true }` will always use both types of rules unless you can guarantee that `MakePlural.cardinals === true`. If that is true, the property `MakePlural.cardinals` can be considered unnecessary.\r\n\r\nI think the only situation where `MakePlural.ordinals` and `MakePlural.cardinals` can be used reasonably is if neither `opt.ordinals` nor `opt.cardinals` is set (see my suggestion above). This would match the old behavior which was quite handy and did not create any conflicts.\r\n\r\nAnother possibility would be to follow @rxaviers' second idea, but that would involve an API change. Alternatively, you might consider removing `MakePlural.ordinals` and `MakePlural.cardinals`. I can think of way more problems than benefits due to those properties."}}