1.0.1 • Published 6 years ago
@mapbox/frontend-util-maybe-add-period v1.0.1
@mapbox/frontend-util-maybe-add-period
Add a period to the end of a string if that string does not already end with sentence-ending punctuation.
Installation
npm install @mapbox/frontend-util-maybe-add-period
Usage
import maybeAddPeriod from '@mapbox/frontend-util-maybe-add-period';
maybeAddPeriod('Call the dentist'); // Call the dentist.
maybeAddPeriod('Call the dentist.'); // Call the dentist.
maybeAddPeriod('Call the dentist!'); // Call the dentist!
maybeAddPeriod('Call the dentist?'); // Call the dentist?