not-ends-with
v1.0.0
Published
A pure utility function to check if a string does not end with a specific suffix.
Maintainers
Readme
not-ends-with
A pure utility function to check if a string does not end with a specific suffix.
notEndsWith(str, searchString, endPosition?)
Returns true if the string does not end with the specified text. It is the inverse of String.prototype.endsWith.
Install:
- Run:
npm install not-ends-with
Parameters:
str(string) — the string to be checked.searchString(string) — the text to search for at the end ofstr.endPosition(number, optional) — the position up to whichstris considered (same behavior as the nativeendsWith).
Return: boolean
Example
import { notEndsWith } from 'not-ends-with';
notEndsWith('hello.js', '.ts'); // true
notEndsWith('hello.ts', '.ts'); // false
notEndsWith('hello.ts.bak', '.ts', 8); // false