A robust & optimized `String.prototype.endsWith` polyfill, based on the ECMAScript 6 specification.
npm install string.prototype.endswith[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
An ESnext spec-compliant String.prototype.endsWith shim/polyfill/replacement that works as far down as ES3.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
Because String.prototype.endsWith depends on a receiver (the this value), the main export takes the string to operate on as the first argument.
Other polyfills for String.prototype.endsWith are available:
*
*
Via npm:
``bash`
npm install string.prototype.endswith
Then, in Node.js:
`js`
var endsWith = require('string.prototype.endswith');
`html`
> NOTE: It's recommended that you install this module using a package manager
> such as npm, because loading multiple polyfills from a CDN (such as bundle.run)
> will lead to duplicated code.
Polyfills + test suites for String.prototype.startsWith and String.prototype.contains are available, too.
|  |
|---|
| Mathias Bynens |
This polyfill is available under the MIT license.
, and run npm test`[package-url]: https://npmjs.org/package/string.prototype.endswith
[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.endsWith.svg
[deps-svg]: https://david-dm.org/es-shims/String.prototype.endsWith.svg
[deps-url]: https://david-dm.org/es-shims/String.prototype.endsWith
[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.endsWith/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.endsWith#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/string.prototype.endswith.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/string.prototype.endswith.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/string.prototype.endswith.svg
[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.endswith