Package detail

string.prototype.split

es-shims11.3kMIT1.0.9

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

es-shim API, ESnext, shim, polyfill

readme

string.prototype.split Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES spec-compliant String.prototype.split shim/polyfill/replacement that works as far down as ES3. There's a number of bugs in various browser versions that this package addresses.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Because String.prototype.split depends on a receiver (the “this” value), the main export takes the string to operate on as the first argument.

Example

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

assert.deepEqual(split('abc', ''), ['a', 'b', 'c']);
var split = require('string.prototype.split');
var assert = require('assert');
/* when String#split is not present */
delete String.prototype.split;
var shimmedSplit = split.shim();

assert.equal(shimmedSplit, String.prototype.split);
assert.deepEqual(shimmedSplit('abc', ''), ['a', 'b', 'c']);
var split = require('string.prototype.split');
var assert = require('assert');
/* when String#split is present */
var shimmedSplit = split.shim();

assert.equal(shimmedSplit, String.prototype.split);
assert.deepEqual(shimmedSplit('abc', ''), ['a', 'b', 'c']);

Tests

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

changelog

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.9 - 2024-03-19

Commits

  • [meta] remove useless ESM f4e0a53
  • [actions] remove redundant finisher c44f201
  • [Deps] update call-bind, define-properties, es-abstract, get-intrinsic, regexp.prototype.flags 49c56af
  • [Robustness] use cached globals 360e5c1
  • [Dev Deps] update aud, npmignore, tape 38dfb5f
  • [Refactor] use es-object-atoms where possible 564baca
  • [meta] add missing engines.node e285efc

v1.0.8 - 2023-09-03

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic, regexp.prototype.flags c93d175
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape 84b9cb5

v1.0.7 - 2022-11-07

Commits

  • [meta] use npmignore to autogenerate an npmignore file 8937c2c
  • [actions] update rebase action to use reusable workflow faadd00
  • [Deps] update es-abstract, get-intrinsic f4238bc
  • [Deps] update define-properties, es-abstract, regexp.prototype.flags 6ae258a
  • [Dev Deps] update aud, tape c23a919
  • [Dev Deps] update @ljharb/eslint-config, functions-have-names c351cf4
  • [Fix] main entry point is named "split" bb8f836

v1.0.6 - 2022-04-08

Commits

  • [actions] reuse common workflows bb283ec
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, safe-publish-latest, tape 2009e5c
  • [actions] update codecov uploader 0ec83c6
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 148a49c
  • [Deps] update es-abstract, regexp.prototype.flags 003e2bc
  • [Robustness] test observably looks up exec on the object a6f8a68

v1.0.5 - 2021-10-04

Commits

  • [actions] use node/install instead of node/run; use codecov action dd30e86
  • [Refactor] remove ESM entry points 928c49d
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, auto-changelog, tape 98d6443
  • [Deps] update es-abstract, is-regex 0e0c732
  • [readme] add github actions/codecov badges 8f121f2
  • [actions] update workflows deb519b
  • [Dev Deps] update eslint, tape c5c02a6
  • [meta] use prepublishOnly script for npm 7+ bca1b3d
  • [Tests] fix nyc@10 with node v12.2 - v12.15 e162f03
  • [Deps] update es-abstract 8c90fe4
  • [Fix] add auto entry point to "exports" 8d7e4ec

v1.0.4 - 2021-02-21

Commits

  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, functions-have-names, has-strict-mode, tape 0643a95
  • [Deps] update call-bind, es-abstract, get-intrinsic, is-regex, regexp.prototype.flags 6b9da47
  • [actions] update workflows 2e1745b
  • [readme] fix repo URLs; remove travis badge d1e9b0a
  • [Tests] increase coverage 520685b

v1.0.3 - 2020-11-21

Commits

  • [Fix] node v0.8: ensure the raw implementation includes this bugfix 60d4bf2

v1.0.2 - 2020-11-19

Commits

  • [Tests] migrate tests to Github Actions 3051ffa
  • [meta] do not publish github action workflow files aba1b8c
  • [Tests] run nyc on all tests c13200e
  • [Refactor] add get-intrinsic and call-bind b3d60d8
  • [actions] add "Allow Edits" workflow f80d595
  • [Tests] make 0.6 required 75f6023
  • [Robustness] cache String.prototype.split.apply in the implementation ef5b3cd
  • [Tests] add aud bf4ef72

v1.0.1 - 2020-08-16

Commits

v1.0.0 - 2020-08-16

Commits