string.prototype.replaceall
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -8,2 +8,14 @@ # Changelog | ||
## [v1.0.5](https://github.com/es-shims/String.prototype.replaceAll/compare/v1.0.4...v1.0.5) - 2021-02-22 | ||
### Commits | ||
- [meta] do not publish github action workflow files [`5bc61a7`](https://github.com/es-shims/String.prototype.replaceAll/commit/5bc61a7765dc78afd3a63b66321dd45a14b2b717) | ||
- [Refactor] use an explicit step for an empty string searchValue [`5c0a89a`](https://github.com/es-shims/String.prototype.replaceAll/commit/5c0a89afdeb3ef722fc81e5a83ee0768ad88b3fa) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es5-shim`, `functions-have-names`, `tape` [`42c1125`](https://github.com/es-shims/String.prototype.replaceAll/commit/42c1125240eea2b2b9f3d49c3de765dee36d1758) | ||
- [readme] remove travis badge [`ee72ded`](https://github.com/es-shims/String.prototype.replaceAll/commit/ee72dede50a46c03c1e6634fcb0e01f5fe1474f1) | ||
- [Deps] update `call-bind`, `es-abstract`, `get-intrinsic`, `is-regex` [`d79e8fc`](https://github.com/es-shims/String.prototype.replaceAll/commit/d79e8fcab0e82d28d27934c47a84134831d4de00) | ||
- [actions] update workflows [`54098df`](https://github.com/es-shims/String.prototype.replaceAll/commit/54098df89d03c5f91d23427ea9bc530012668f4e) | ||
- [Tests] increase coverage [`e9e96b6`](https://github.com/es-shims/String.prototype.replaceAll/commit/e9e96b6355c9416a2fc48d98ade934996ce8fb33) | ||
## [v1.0.4](https://github.com/es-shims/String.prototype.replaceAll/compare/v1.0.3...v1.0.4) - 2020-11-21 | ||
@@ -10,0 +22,0 @@ |
@@ -34,5 +34,16 @@ 'use strict'; | ||
var len = string.length; | ||
if (searchValue === '' && fromIndex <= len) { | ||
return fromIndex; | ||
} | ||
var searchLen = searchValue.length; | ||
for (var i = fromIndex; i < string.length; i += 1) { | ||
// Note 2 of https://tc39.es/ecma262/#sec-stringindexof | ||
if (fromIndex > len) { | ||
return -1; | ||
} | ||
for (var i = fromIndex; i < len; i += 1) { | ||
if (searchValue === '' || $slice(string, i, i + searchLen) === searchValue) { | ||
@@ -72,7 +83,2 @@ return i; | ||
// TODO: this may be a workaround for broken spec text; see https://github.com/tc39/proposal-string-replaceall/issues/32 | ||
if (searchString === '') { | ||
return $replace(string, /(?:)/g, replaceValue); | ||
} | ||
var searchLength = searchString.length; | ||
@@ -79,0 +85,0 @@ var advanceBy = max(1, searchLength); |
{ | ||
"name": "string.prototype.replaceall", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Spec-compliant polyfill for String.prototype.replaceAll ESnext proposal", | ||
@@ -44,21 +44,21 @@ "main": "index.js", | ||
"@es-shims/api": "^2.1.2", | ||
"@ljharb/eslint-config": "^17.2.0", | ||
"aud": "^1.1.3", | ||
"@ljharb/eslint-config": "^17.5.1", | ||
"aud": "^1.1.4", | ||
"auto-changelog": "^2.2.1", | ||
"es5-shim": "^4.5.14", | ||
"es5-shim": "^4.5.15", | ||
"es6-shim": "^0.35.6", | ||
"eslint": "^7.14.0", | ||
"eslint": "^7.20.0", | ||
"evalmd": "^0.0.19", | ||
"functions-have-names": "^1.2.1", | ||
"functions-have-names": "^1.2.2", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.0.1" | ||
"tape": "^5.2.0" | ||
}, | ||
"dependencies": { | ||
"call-bind": "^1.0.0", | ||
"call-bind": "^1.0.2", | ||
"define-properties": "^1.1.3", | ||
"es-abstract": "^1.18.0-next.1", | ||
"get-intrinsic": "^1.0.1", | ||
"es-abstract": "^1.18.0-next.2", | ||
"get-intrinsic": "^1.1.1", | ||
"has-symbols": "^1.0.1", | ||
"is-regex": "^1.1.1" | ||
"is-regex": "^1.1.2" | ||
}, | ||
@@ -65,0 +65,0 @@ "auto-changelog": { |
# string.prototype.replaceall <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
[![Build Status][travis-svg]][travis-url] | ||
[![dependency status][deps-svg]][deps-url] | ||
@@ -47,5 +46,3 @@ [![dev dependency status][dev-deps-svg]][dev-deps-url] | ||
[package-url]: https://npmjs.com/package/string.prototype.replaceall | ||
[npm-version-svg]: http://versionbadg.es/es-shims/String.prototype.replaceAll.svg | ||
[travis-svg]: https://travis-ci.org/es-shims/String.prototype.replaceAll.svg | ||
[travis-url]: https://travis-ci.org/es-shims/String.prototype.replaceAll | ||
[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.replaceAll.svg | ||
[deps-svg]: https://david-dm.org/es-shims/String.prototype.replaceAll.svg | ||
@@ -56,5 +53,5 @@ [deps-url]: https://david-dm.org/es-shims/String.prototype.replaceAll | ||
[npm-badge-png]: https://nodei.co/npm/string.prototype.replaceall.png?downloads=true&stars=true | ||
[license-image]: http://img.shields.io/npm/l/string.prototype.replaceall.svg | ||
[license-image]: https://img.shields.io/npm/l/string.prototype.replaceall.svg | ||
[license-url]: LICENSE | ||
[downloads-image]: http://img.shields.io/npm/dm/string.prototype.replaceall.svg | ||
[downloads-url]: http://npm-stat.com/charts.html?package=string.prototype.replaceall | ||
[downloads-image]: https://img.shields.io/npm/dm/string.prototype.replaceall.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.replaceall |
@@ -5,4 +5,3 @@ 'use strict'; | ||
require('es6-shim'); | ||
var replaceAllShim = require('../'); | ||
replaceAllShim.shim(); | ||
require('../auto'); | ||
@@ -9,0 +8,0 @@ var test = require('tape'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177
21298
16
56
Updatedcall-bind@^1.0.2
Updatedes-abstract@^1.18.0-next.2
Updatedget-intrinsic@^1.1.1
Updatedis-regex@^1.1.2