typographic-apostrophes
!NPM versionnpm-imagenpm-url
!Build Statustravis-imagetravis-url
!Coveralls Statuscoveralls-imagecoveralls-url
!Dependency Statusdepstat-imagedepstat-url
!DevDependency Statusdepstat-dev-imagedepstat-dev-urlMake sure they’re curly and point downwardrtfm
Micro module to help eliminate one of the bad typewriter habitshabits.
Install
npm install --save typographic-apostrophes
Usage
Use typographic apostrophes in contractions and for possessive case. This module don't cover posessive plurals, because it’s impossible to distinguish it from single closing quote.That's why I created typographic-apostrophes-for-possessive-pluralsplurals, but it can be used safely only if there are zero closing quotes in the input; this can be achieved by typographic-quotesquotes. That’s why for ideal result you should use all three modules in the chain:
apostrophes → quotes → apostrophes-for-possessive-plurals
(order is important).var apostrophes = require('typographic-apostrophes');
apostrophes(`I'm looking forward`); // I’m looking forward
apostrophes(`Don't do it!`); // Don’t do it!
apostrophes(`as in the eagle's feathers`); // as in the eagle’s feathers
apostrophes(`in one month's time`); // in one month’s time
apostrophes(`'60s and '80s`); // ’60s and ’80s
apostrophes(`rock'n'roll`); // rock’n’roll
apostrophes(`rock 'n' roll`); // rock ’n’ roll