Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with quotes #15

Closed
DatGuyJonathan opened this issue May 19, 2020 · 1 comment
Closed

Issues with quotes #15

DatGuyJonathan opened this issue May 19, 2020 · 1 comment

Comments

@DatGuyJonathan
Copy link

Here are some test cases for the issues. First test case is what you have in the README. Second and third test cases are the issues.

var capitalize = require('capitalize')

var test = require('tape')

test('Quotes test case 1', function(t) {
    t.plan(1)
    t.equal(capitalize.words("it's a nice day"), "It's A Nice Day")
})

// This becomes: It’S A Boy
test('Quotes test case 2', function(t) {
    t.plan(1)
    t.equal(capitalize.words("It’s a Boy"), "It’s a Boy")
})

// This becomes: 'there's Angels Among Us'
test('Quotes test case 3', function(t) {
    t.plan(1)
    t.equal(capitalize.words("'There's angels among us'"), "'There's Angels Among Us'")
})
@grncdr
Copy link
Owner

grncdr commented May 20, 2020

Thanks for reporting this issue. I'm not likely to get to it right now, and I can see that it will probably complicate the code quite a bit to solve, so I'm not sure I will do it at all. I would definitely accept a PR that makes those test cases pass. As a general approach I think one would need to first extract "balanced pairs" of quotes then recursively capitalize their contents.

@grncdr grncdr closed this as completed in 887b0b0 Oct 24, 2021
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

No branches or pull requests

2 participants