@hotequil/proposal-remove-string
v0.1.0
Published
TC39 proposal to implement the String.prototype.remove.
Maintainers
Readme
Remove string proposal
TC39 proposal to implement the String.prototype.remove.

Reason
The motivation behind this proposal is to
simplify the text replacement within JavaScript. Currently, to remove some text in a string, you need to use
the replace or replaceAll methods passing an empty string as a second parameter. This
is an ugly way. So this proposal doesn't change the memory value and removes the second parameter.
How it works
It receives one string or RegExp that returns a new string.
Installation
Install the package using npm or another package manager you want.
npm install @hotequil/proposal-remove-stringUsage
Import the polyfill in the main, index or app file of your project.
import "@hotequil/proposal-remove-string";Typical cases
Follow the examples in TypeScript below.
// Imports omitted…
"bitcoin-mainnet".remove("-mainnet")
// "bitcoin"
"bitcoin-mainnet".remove(/-mainnet/)
// "bitcoin"
"bitcoin mainnet mainnet".remove("mainnet", { trim: true })
// "bitcoin"
"bitcoin mainnet mainnet".remove(/mainnet/, { trim: true })
// "bitcoin"Proposer
- Author: @hotequil;
- Champion(s): no one at the moment.
This repository there is no other third dependency, see the package.json.
