Skip to content

lo1tuma/ensure-string-endswith

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ensure-string-endswith

Travis

Creates a function that appends a given character to a string, if (and only if) it does not already end with that character.

usage

var anyString = 'anyString',
    stringEndingWithSlash = 'endsWith/',
    ensureStringEndsWithSlash = ensureStringEndsWith('/');

ensureStringEndsWithSlash(anyString) === anyString + '/';                   // true
ensureStringEndsWithSlash(stringEndingWithSlash) === stringEndingWithSlash; // true

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%