JSPM

string.prototype.substr

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q51355F
  • License MIT

ES spec-compliant `String.prototype.substr` shim/polyfill/replacement that works as far down as ES3

Package Exports

  • string.prototype.substr
  • string.prototype.substr/auto
  • string.prototype.substr/implementation
  • string.prototype.substr/package.json
  • string.prototype.substr/polyfill
  • string.prototype.substr/shim

Readme

String.prototype.substr Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES-spec-compliant String.prototype.substrshim/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.

Getting started

npm install --save string.prototype.substr

Usage/Examples

var assert = require('assert');
var substr = require('string.prototype.substr');

assert(substr('abc', 1) === 'bc');

substr.shim(); // will be a no-op if not needed

assert(substr(' \t\na \t\n') === ' \t\na \t\n'.substr());

Tests

Clone the repo, npm install, and run npm test