Skip to content

Fixed separator bug#2

Closed
franciscocgoncalves wants to merge 2 commits intoljharb:masterfrom
franciscocgoncalves:master
Closed

Fixed separator bug#2
franciscocgoncalves wants to merge 2 commits intoljharb:masterfrom
franciscocgoncalves:master

Conversation

@franciscocgoncalves
Copy link

When reading your example I noticed that you were inserting a separator after the penultimate element of the array before the lastWord which, in my opinion, isn't appropriate for use in a sentence.

I changed it in the following way.

Behavior before fix:

assert(listify([1, 2, 3, 4]) === '1, 2, 3, and 4');

Behavior after fix:

assert(listify([1, 2, 3, 4]) === '1, 2, 3 and 4');

I also added a validation test that asserts two items with finalWord.

@ljharb
Copy link
Owner

ljharb commented May 7, 2015

I'm sorry, but the Oxford comma is required for my module, and is also quite grammatically correct in an English sentence. (for what it's worth, thank you very much for a pull request that's detailed, and includes both the relevant tests and documentation updates!)

why i still use the oxford comma

strippers

@ljharb ljharb closed this May 7, 2015
@franciscocgoncalves
Copy link
Author

To be honest, I didn't know about this so I did a little research. This is what I found out:

  • Oxford Comma is used less often in Britain English and accordingly to the University of Oxford Style Guide it should be use to prevent ambiguity but it isn't mandatory;
  • in American English, a majority of style guides mandate use of the Oxford Comma;
  • the Stylebook published by The Canadian Press for journalistic writing advise against the Oxford Comma;

Some of this information is on Wikipedia.

I'm aware of the controversy of this matter and that it is required on your module, but shouldn't it be optional? If it was not only it would support all the style guides but also other languages like Portuguese.

@ljharb
Copy link
Owner

ljharb commented May 7, 2015

@franciscocgoncalves Fair point - I'd be open to accepting a pull request adding an option to omit the Oxford comma, despite personally feeling strongly that it should always be used :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants