包详细信息

string.prototype.endswith

mathiasbynens124.2kMIT1.0.2

A robust & optimized String.prototype.endsWith polyfill, based on the ECMAScript 6 specification.

string, endswith, es6, ecmascript

自述文件

string.prototype.endswith Version Badge

dependency status dev dependency status License Downloads

npm badge

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:

Installation

Via npm:

npm install string.prototype.endswith

Then, in Node.js:

var endsWith = require('string.prototype.endswith');
<script src="https://bundle.run/string.prototype.endswith"></script>

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.

Notes

Polyfills + test suites for String.prototype.startsWith and String.prototype.contains are available, too.

Author

twitter/mathias
Mathias Bynens

License

This polyfill is available under the MIT license.

Tests

Simply clone the repo, npm install, and run npm test

更新日志

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.2 - 2024-03-18

Commits

  • [Deps] update call-bind, define-properties, es-abstract 38e22e6
  • [eslint] fix linting errors 44cfb77
  • [Dev Deps] update aud, function-bind, tape 6f50b14
  • [Refactor] use es-object-atoms instead of es-abstract when possible 42aa444
  • [meta] add missing engines.node bccb5bb

v1.0.1 - 2023-09-11

Commits

  • [eslint] add eslint fb8cc46
  • [Tests] Switch from travis to GH actions b35ea44
  • [meta] add auto-changelog b6da653
  • Set up automated npm publish b9be2b4
  • [readme] move maintainer instructions to CONTRIBUTING.md 46da5f5
  • [readme] update badges 64e2a03
  • [Deps] update define-properties, es-abstract; add call-bind 185ac54
  • [Tests] switch from istanbul to nyc 8d33676
  • [actions] use reusable rebase action a53f174
  • [actions] fix publish workflow 84d19c3
  • [Dev Deps] update @es-shims/api, functions-have-names, tape 9543e15
  • [meta] remove broken getPolyfill entry point; add correct polyfill entry point 0d5242c
  • [Tests] rename tests to test 5e344d8
  • [Tests] add aud via npm run posttest 699cf8c

v1.0.0 - 2020-05-21

Commits

  • Merge pull request #9 from mathiasbynens/nr/es-shim-api 272752d
  • Use tape in tests and run them on every Node.js version 8030508
  • [breaking] Implement the es-shim-api interface c6eb152
  • Use HTTPS URLs where possible a0eea7f
  • Update readme 15ba134
  • Test that it respects the es-shim-api interface 1baf690
  • Update repo config files e5b7310
  • Improve error messages 6853d40

v0.2.0 - 2014-04-10

Fixed

  • Follow spec order #5

Commits

  • Avoid IE8’s broken Object.defineProperty e27c8f2
  • Add more tests cc63a25
  • Make the endsWith property non-enumerable bffbff9
  • Avoid lastIndexOf bb6501c
  • Tag the v0.2.0 release ca2dddb
  • README: Explicitly request SVG badges c20c83a
  • Perform RegExp check after ToString(this) f375ac0
  • README: Mention polyfills for similar functions 960fccb
  • Use charCodeAt instead of charAt bb1901f
  • Avoid isNaN dd38046
  • README: Update Traceur link c34bff5
  • README: Update es6-shim link f51af73
  • Fix typo in test e10ff32
  • README: Update link c28d87c
  • README: Note that Traceur now uses this polyfill 2e2d880

v0.1.0 - 2013-12-17

Commits