@@ -71,7 +71,7 @@ module.exports = {
name: 'description',
message: 'Package description (one sentence, must end with period):'
} ], ( answers ) => {
- resolve( sanitize.appendPeriodIfMissing( answers.description ) );
+ resolve( sanitize.appendPeriodIfMissing( answers.description || '' ) );
} );
}
@@ -7,10 +7,10 @@
module.exports = {
appendPeriodIfMissing( text ) {
- text = text ? text.trim() : '';
+ text = text.trim();
const length = text.length;
- if ( length > 0 && text[ length - 1 ] !== '.' ) {
+ if ( length > 0 && !text.endsWith( '.' ) ) {
text += '.';