This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ensure-string-endswith

1.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i ensure-string-endswith

    Weekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • lxanders
    • polycodal