dodo / node-slug

slugifies even utf-8 chars!
MIT License
1.07k stars 94 forks source link

lowercase result & exclamation point in charmap #17

Closed reqshark closed 10 years ago

reqshark commented 10 years ago

a PR with two separate things.

1) @jbraithwaite's fork keeps our end result completely lowercase by including the unmodified characters in his call toLowerCase() just before returning the result, so regular capitalized letters will get lowercased. Check out his work on this commit.

2) Adding the exclamation point symbol as a key in our charmap with a single space character value for its associated replacement string.

Why the single space character? Because I want to remove any exclamation points from input strings containing the exclamation punctuation marks! We might consider doing this as a default so that's the 2nd part of the PR

dodo commented 10 years ago

don't get me wrong, but i don't see the advantage if this PR if you could just do:

slug.defaults.charmap['!'] = " "
slug(text).toLowerCase()
reqshark commented 10 years ago

when you put it that way I couldn't agree with you more. that's exactly what I want to do. I completely missed that when I tried to understand readme example using repl

dodo commented 10 years ago

how should the readme look like in your opinion, to get this kind of information from it?

reqshark commented 10 years ago

I guess mainly when different cases are given a line or two of space it's easier to consume their purpose and message. a brief description before the code is sometimes nice but not always necessary

I love the repl but when I go to look at a new package for a require() in my own projects, usually I find helpful examples when they are in the context of a snippet for a file. often there's a setup followed by a use case example or two--but that's just what I am accustomed to seeing.

personally IMO, some of the clearest examples in the readme to quickly understand are packages authored by TooTallNate https://www.npmjs.org/~tootallnate like the file-uri-to-path or get-uri

dodo commented 10 years ago

thank you very much for your help.