JSPM

add-ender

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q36874F
  • License MIT

add a period to a string if it doesn't already end in one

Package Exports

  • add-ender

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (add-ender) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

add-ender

Do you ever have this issue with your robots?

IKNORITE?

if only it had inserted a period there between the sentences that would have been a hot toot!

NOT ANYMORE

add-ender will check the last character or your string and see if it is . or ? or ! and if it is not it will append a . to that string and return it unto you.

NPM js-standard-style Build Status

EXAMPLE

var addEnder = require('add-ender')
var str = 'wow it really works'

addEnder(str, '!')
// => 'wow it really works!'

// lets get more excited about this!
addEnder(str, '!').toUpperCase()
// => 'WOW IT REALLY WORKS!'

API

addEnder(str, ender || '.', reggie || /(\.|\?|\!)$/)

  • str: any string. probably the output of some sort of api call or text generator or twitter stream or idk. you know it is a "sentence" but it is possible it does not end with proper punctuation.

  • ender: any string. probably something like . or ? or !.

  • reggie: any reginald or regex. defaults to the . or ? or ! thing.