
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Replace or Strip special character, alphabets and numerics from string or object - Javascipt - Node.js
when you are working with Javascript | Node.js you can simply filter, strip or replace special characters,
alphabets and numerics from string or object by using this repository.
npm install stripchar
var stripchar = require('stripchar').StripChar;
// Strip all special characters EXCEPT underscore and alphanumeric
stripchar.RSExceptUnsAlpNum(input);
// Example
stripchar.RSExceptUnsAlpNum('ne@w_t#est_id_@12'); // new_test_id_12
// Replace all special characters with desired oone EXCEPT underscore and alphanumeric
stripchar.RSExceptUnsAlpNum(input, replacewith);
// Example
stripchar.RSExceptUnsAlpNum('new@test@id_12', '_'); // new_test_id_12
// Strip all special characters EXCEPT underscore and alphabet
stripchar.RSExceptUnsAlpha(input);
// Example
stripchar.RSExceptUnsAlpha('ne@w_t#est_id_12'); // new_test_id_12
// Replace all special characters with desired oone EXCEPT underscore and alphabet
stripchar.RSExceptUnsAlpha(input, replacewith);
// Example
stripchar.RSExceptUnsAlpha('new@test@id_12', '_'); // new_test_id_12
// Strip all special characters EXCEPT alphanumeric
stripchar.RSspecChar(input);
// Example
stripchar.RSspecChar('new@test@id'); // newtestid
// Replace all special characters with desired one EXCEPT alphanumeric
stripchar.RSspecChar(input, replacewith);
// Example
stripchar.RSspecChar('new@test@id', '_'); // new_test_id
// Strip everything EXCEPT numerics
stripchar.RSExceptNum(input);
// Example
stripchar.RSExceptNum('new@test@id_99'); // 99
// Replace everything with desired character EXCEPT numerics
stripchar.RSExceptNum(input, replacewith);
// Example
stripchar.RSExceptNum('new@test@id@99', '_'); // ____________99
// Strip everything EXCEPT alphabets
stripchar.RSExceptAlpha(input);
// Example
stripchar.RSExceptAlpha('new@test@id_99'); // newtestid
// Replace everything with desired character EXCEPT alphabets
stripchar.RSExceptAlpha(input, replacewith);
// Example
stripchar.RSExceptAlpha('new@test@id@99', '#'); // new#test#id###
Use the following format of either string or object or else you will get "false" in return.
// JSON format
var obj = {"col1": "id_1", "col2": "id_2", "col3": "id_3"};
// String format
var str = 'new_test_id';
when using replacing part of function do not not use the following as replacement otherwise it will be ignored automatically.
stripchar.RSExceptAlpha('new@test@id@99', 'null'); // return false
stripchar.RSExceptAlpha('new@test@id@99', 'undefined'); // return false
simply type the following command to run the test from CLI.
npm test
// OR
mocha
Stripchar is free software distributed under the terms of the MIT license.
Please support the project development, even a small donation can help grow this project!
Is there something new you like to see in this package ? Please contact me and i'll do my best to implement that in next releases.
FAQs
Replace or Strip special character, alphabets and numerics from string or object - Javascipt - Node.js
The npm package stripchar receives a total of 2,566 weekly downloads. As such, stripchar popularity was classified as popular.
We found that stripchar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.