@@ -8,9 +8,8 @@
module.exports = {
appendPeriodIfMissing( text ) {
text = text.trim();
- const length = text.length;
- if ( length > 0 && !text.endsWith( '.' ) ) {
+ if ( text.length > 0 && !text.endsWith( '.' ) ) {
text += '.';
}
@@ -42,7 +42,9 @@ describe( 'utils', () => {
} );
it( 'should return empty string when invoked with empty string', () => {
- expect( sanitize.appendPeriodIfMissing( '' ) ).to.equal( '' );
+ const sanitized = sanitize.appendPeriodIfMissing( '' );
+
+ expect( sanitized ).to.equal( '' );