Skip to content

wessberg/es6-string-polyfills

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polyfills for ES6 string methods.

Based primarily on the implementations by Mathias Bynens.

String.raw is loosely based on 59naga's ponyfill, but the original doesn't correctly handle substitutions. This one binds to the String object (the original does not.)

String.normalize is not covered. It is simply too big (~140kb minified).

It covers:

  • String.prototype.codePointAt
  • String.prototype.repeat
  • String.prototype.includes
  • String.prototype.startsWith
  • String.prototype.endsWith
  • String.prototype.fromCodePoint
  • String.raw

Install

Install with

npm install es6-string-polyfills --save-dev

Usage

Load it in your code with an import statement:

import "es6-string-polyfills";

Or from a script tag:

<script src="../node_modules/es6-string-polyfills/polyfill.min.js"></script>

The polyfills will be applied automatically if necessary.

About

Polyfills for all new es6 string methods (except String.normalize).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published