Security upgrades
This commit is contained in:
19
node_modules/string-sanitizer/index.d.ts
generated
vendored
Normal file
19
node_modules/string-sanitizer/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
type TSanitizer = (s: string) => string;
|
||||
|
||||
interface ISanitize extends TSanitizer {
|
||||
keepUnicode: TSanitizer;
|
||||
keepSpace: TSanitizer;
|
||||
addFullstop: TSanitizer;
|
||||
addUnderscore: TSanitizer;
|
||||
addDash: TSanitizer;
|
||||
removeNumber: TSanitizer;
|
||||
keepNumber: TSanitizer;
|
||||
}
|
||||
|
||||
const sanitize: ISanitize;
|
||||
const addFullstop: TSanitizer;
|
||||
const addUnderscore: TSanitizer;
|
||||
const addDash: TSanitizer;
|
||||
const removeSpace: TSanitizer;
|
||||
|
||||
export { sanitize, addFullstop, addUnderscore, addDash, removeSpace };
|
||||
55
node_modules/string-sanitizer/index.js
generated
vendored
Normal file
55
node_modules/string-sanitizer/index.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
exports.sanitize = function(str) {
|
||||
return str.replace(/[^a-zA-Z0-9]/g, "");
|
||||
};
|
||||
|
||||
exports.sanitize.keepUnicode = function(str) {
|
||||
return str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "");
|
||||
};
|
||||
|
||||
exports.sanitize.keepSpace = function(str) {
|
||||
var str2 = str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "");
|
||||
return str2.replace(/ /g, " ");
|
||||
};
|
||||
|
||||
exports.sanitize.addFullstop = function(str) {
|
||||
var str2 = str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "");
|
||||
return str2.replace(/ /g, ".");
|
||||
};
|
||||
|
||||
exports.sanitize.addUnderscore = function(str) {
|
||||
var str2 = str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "");
|
||||
return str2.replace(/ /g, "_");
|
||||
};
|
||||
|
||||
exports.sanitize.addDash = function(str) {
|
||||
var str2 = str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "");
|
||||
return str2.replace(/ /g, "-");
|
||||
};
|
||||
|
||||
exports.sanitize.removeNumber = function(str) {
|
||||
return str.replace(/[^a-zA-Z]/g, "");
|
||||
};
|
||||
|
||||
exports.sanitize.keepNumber = function(str) {
|
||||
return str.replace(/[^a-zA-Z0-9]/g, "");
|
||||
};
|
||||
|
||||
// Add Fullstop, Underscore & Dash without sanitizing
|
||||
|
||||
exports.addFullstop = function(str) {
|
||||
return str.replace(/ /g, ".");
|
||||
};
|
||||
exports.addUnderscore = function(str) {
|
||||
return str.replace(/ /g, "_");
|
||||
};
|
||||
|
||||
exports.addDash = function(str) {
|
||||
return str.replace(/ /g, "-");
|
||||
};
|
||||
|
||||
// Remove Space without sanitizing
|
||||
exports.removeSpace = function(str) {
|
||||
return str.replace(/\s+/g, "");
|
||||
};
|
||||
21
node_modules/string-sanitizer/license
generated
vendored
Normal file
21
node_modules/string-sanitizer/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Md. Fazlul Karim <fazlulkarimrocky@gmail.com> (http://twitter.com/fazlulkarimweb)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
58
node_modules/string-sanitizer/package.json
generated
vendored
Normal file
58
node_modules/string-sanitizer/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "string-sanitizer",
|
||||
"_id": "string-sanitizer@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ZaqlidMholFiBaKDPPVf9cJjNo6iRhP6g/ei5qTgvzKEMa8TK/nu4hM90YZ2LvfjvAomF2LIexmOlX1MvYN+ug==",
|
||||
"_location": "/string-sanitizer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "string-sanitizer",
|
||||
"name": "string-sanitizer",
|
||||
"escapedName": "string-sanitizer",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/string-sanitizer/-/string-sanitizer-1.1.1.tgz",
|
||||
"_shasum": "52d583fa639aefa01bc9a9d68cd4d53644cd85c5",
|
||||
"_spec": "string-sanitizer",
|
||||
"_where": "D:\\WORK\\Menui\\menui_backend",
|
||||
"author": {
|
||||
"name": "Md Fazlul Karim",
|
||||
"email": "fazlulkarimrocky@gmail.com",
|
||||
"url": "https://twitter.com/fazlulkarimweb"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/fazlulkarimweb/string-sanitizer/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "An intuitive & tiny string sanitizer to remove any special characters or convert strings to create filename or url 🎉🎉",
|
||||
"homepage": "https://github.com/fazlulkarimweb/string-sanitizer#readme",
|
||||
"keywords": [
|
||||
"string sanitizer",
|
||||
"string filename",
|
||||
"remove special characters",
|
||||
"convert string",
|
||||
"sanitize string",
|
||||
"string url",
|
||||
"string converter",
|
||||
"special characters removal",
|
||||
"custom string",
|
||||
"beautiful string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "node.js",
|
||||
"name": "string-sanitizer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/fazlulkarimweb/string-sanitizer.git"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
67
node_modules/string-sanitizer/readme.md
generated
vendored
Normal file
67
node_modules/string-sanitizer/readme.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# String Sanitizer
|
||||
|
||||
An intuitive & tiny string sanitizer to remove any special characters or convert strings to create filename or url 🎉🎉
|
||||
|
||||
# Use Case
|
||||
|
||||
Converting or sanitizing string is easier than ever with the help of this package. You can use this utility package to sanitize even foreign languages other than English. Under the hood, regex is heavily used in this library. You can convert your string to url or filename frindly string.
|
||||
🎉🎉
|
||||
|
||||
## Installation
|
||||
|
||||
You can download this package from here - [string-sanitizer npm](https://www.npmjs.com/package/string-sanitizer)
|
||||
|
||||
```bash
|
||||
npm i string-sanitizer
|
||||
```
|
||||
|
||||
Yarn installation
|
||||
|
||||
```bash
|
||||
yarn add string-sanitizer
|
||||
```
|
||||
|
||||
## Usage 👀👀👀
|
||||
|
||||
Just pass your string as the argument. The method will return a sanitized or converted string instantly.
|
||||
|
||||
```js
|
||||
var string = require("string-sanitizer");
|
||||
let someString = "@abcde$f$gh";
|
||||
string.sanitize(someString); // abcdefgh
|
||||
```
|
||||
|
||||
# Other Use Cases
|
||||
|
||||
```js
|
||||
var string = require("string-sanitizer");
|
||||
|
||||
string.sanitize("a.bc@d efg#h"); // abcdefgh
|
||||
string.sanitize.keepSpace("a.bc@d efg#h"); // abcd efgh
|
||||
string.sanitize.keepUnicode("a.bc@d efg#hক"); // abcd efghক
|
||||
string.sanitize.addFullstop("a.bc@d efg#h"); // abcd.efgh
|
||||
string.sanitize.addUnderscore("a.bc@d efg#h"); // abcd_efgh
|
||||
string.sanitize.addDash("a.bc@d efg#h"); // abcd-efgh
|
||||
string.sanitize.removeNumber("@abcd efgh123"); // abcdefgh
|
||||
string.sanitize.keepNumber("@abcd efgh123"); // abcdefgh123
|
||||
string.addFullstop("abcd efgh"); // abcd.efgh
|
||||
string.addUnderscore("@abcd efgh"); // @abcd_efgh
|
||||
string.addDash("@abcd efgh"); // @abcd-efgh
|
||||
string.removeSpace("@abcd efgh"); // @abcdefgh
|
||||
```
|
||||
|
||||
## Show Me the Code
|
||||
|
||||

|
||||
|
||||
## Typescript compatitibility
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
||||
|
||||
Please make sure to update tests as appropriate. 🏃🏃
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/fazlulkarimweb/string-sanitizer/blob/master/license)
|
||||
70
node_modules/string-sanitizer/test.js
generated
vendored
Normal file
70
node_modules/string-sanitizer/test.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var string = require("./index");
|
||||
|
||||
// string.sanitize("a.bc@d efg#h") = abcdefgh
|
||||
// string.sanitize.keepSpace("a.bc@d efg#h") = abcd efgh
|
||||
// string.sanitize.keepUnicode("a.bc@d efg#hক") = abcd efghক
|
||||
// string.sanitize.addFullstop("a.bc@d efg#h") = abcd.efgh
|
||||
// string.sanitize.addUnderscore("a.bc@d efg#h") = abcd_efgh
|
||||
// string.sanitize.addDash("a.bc@d efg#h") = abcd-efgh
|
||||
// string.sanitize.removeNumber("@abcd efgh123") = abcdefgh
|
||||
// string.sanitize.keepNumber("@abcd efgh123") = abcdefgh123
|
||||
// string.addFullstop("abcd efgh") = abcd.efgh
|
||||
// string.addUnderscore("@abcd efgh") = @abcd_efgh
|
||||
// string.addDash("@abcd efgh") = @abcd-efgh
|
||||
// string.removeSpace("@abcd efgh") = @abcdefgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize("a.bc@d efg#h") = `,
|
||||
string.sanitize("a.bc@d efg#h")
|
||||
); // abcdefgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize.keepSpace("a.bc@d efg#h") = `,
|
||||
string.sanitize.keepSpace("a.bc@d efg#h")
|
||||
); // abcd efgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize.keepUnicode("a.bc@d efg#hক") = `,
|
||||
string.sanitize.keepSpace("a.bc@d efg#hক")
|
||||
); // abcd efghক
|
||||
|
||||
console.log(
|
||||
`string.sanitize.addFullstop("a.bc@d efg#h") = `,
|
||||
string.sanitize.addFullstop("a.bc@d efg#h")
|
||||
); // abcd.efgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize.addUnderscore("a.bc@d efg#h") = `,
|
||||
string.sanitize.addUnderscore("a.bc@d efg#h")
|
||||
); // abcd_efgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize.addDash("a.bc@d efg#h") = `,
|
||||
string.sanitize.addDash("a.bc@d efg#h")
|
||||
); // abcd-efgh
|
||||
|
||||
console.log(
|
||||
`string.sanitize.removeNumber("@abcd efgh123") = `,
|
||||
string.sanitize.removeNumber("@abcd efgh123")
|
||||
); // abcdefgh
|
||||
console.log(
|
||||
`string.sanitize.keepNumber("@abcd efgh123") = `,
|
||||
string.sanitize.keepNumber("@abcd efgh123")
|
||||
); // abcdefgh123
|
||||
|
||||
console.log(
|
||||
`string.addFullstop("abcd efgh") = `,
|
||||
string.addFullstop("abcd efgh")
|
||||
); // abcd.efgh
|
||||
|
||||
console.log(
|
||||
`string.addUnderscore("@abcd efgh") = `,
|
||||
string.addUnderscore("@abcd efgh")
|
||||
); // @abcd_efgh
|
||||
|
||||
console.log(`string.addDash("@abcd efgh") = `, string.addDash("@abcd efgh")); // @abcd-efgh
|
||||
|
||||
console.log(
|
||||
`string.removeSpace("@abcd efgh") = `,
|
||||
string.removeSpace("@abcd efgh")
|
||||
); // @abcdefgh
|
||||
Reference in New Issue
Block a user