Description:
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.
Installation:
npm install stripchar
Require:
var stripchar = StripChar;
Usage:
// Strip all special characters EXCEPT underscore and alphanumeric stripchar; // Example stripchar; // new_test_id_12
// Replace all special characters with desired oone EXCEPT underscore and alphanumeric stripchar; // Example stripchar; // new_test_id_12
// Strip all special characters EXCEPT underscore and alphabet stripchar; // Example stripchar; // new_test_id_12
// Replace all special characters with desired oone EXCEPT underscore and alphabet stripchar; // Example stripchar; // new_test_id_12
// Strip all special characters EXCEPT alphanumeric stripchar; // Example stripchar; // newtestid
// Replace all special characters with desired one EXCEPT alphanumeric stripchar; // Example stripchar; // new_test_id
// Strip everything EXCEPT numerics stripchar; // Example stripchar; // 99
// Replace everything with desired character EXCEPT numerics stripchar; // Example stripchar; // ____________99
// Strip everything EXCEPT alphabets stripchar; // Example stripchar; // newtestid
// Replace everything with desired character EXCEPT alphabets stripchar; // Example stripchar; // new#test#id###
Instructions:
Use the following format of either string or object or else you will get "false" in return.
// JSON formatvar obj = "col1": "id_1" "col2": "id_2" "col3": "id_3"; // String formatvar 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; // return false stripchar; // return false
Run Test:
simply type the following command to run the test from CLI.
npm test // OR mocha
License
Stripchar is free software distributed under the terms of the MIT license.
Please support this project
Please support the project development, even a small donation can help grow this project!
Interested in some new feature?
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.