fazlulkarimweb / string-sanitizer Goto Github PK
View Code? Open in Web Editor NEWAn intuitive & tiny string sanitizer to remove any special characters or convert strings to create filename or url ๐๐
License: MIT License
An intuitive & tiny string sanitizer to remove any special characters or convert strings to create filename or url ๐๐
License: MIT License
While I understand your stance on making everything lowercase by default implicitly, would be nice to have the option to not do it as well, while still applying the rest of the sanitizing options.
As title. Would be nice to have an option to filter everything but numbers and the full-stop character.
Of course, you can restrict input type to number and step "0.01" if you are considering money on front end, but that assumes this package is exclusively used for web development.
Upon building, I get the following error:
yarn run v1.22.11
$ tsc
node_modules/string-sanitizer/index.d.ts:13:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
13 const sanitize: ISanitize;
~~~~~
Found 1 error.
error Command failed with exit code 2.
From looking around, it looks like you add a module to the existing d.ts
file so it becomes:
declare module 'string-sanitizer' {
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 }
}
As a workaround, you can add the above file to a directory such as types/string-sanitizer.d.ts
then point to it in your tsconfig.json
with:
{
"compilerOptions": {
"paths": {
"string-sanitizer": ["types/string-sanitizer.d.ts"]
}
}
}
Hi
I have this warning with npm
DeprecationWarning: Invalid 'main' field in 'node_modules/string-sanitizer/package.json' of 'node.js'. Please either fix that or report it to the module author
Thanks
Hello, I was just looking to use this package but upon attempting to use the email validation the typechecker informed me that it wasn't aware of a validate
export. While the export exists, it is not included in the typescript declarations file, so the typechecker is not aware of it.
Would Uppercase the first letter in each word, lowercase every following letter, and remove all numbers and symbols (unless they are symbols from another language). The minimum size would also be 2, just like username, as there are people called Ed, Bo, etc.
Let me know if you are interested this upcoming week, I wouldn't mind contributing when I have some free time and while I'm still at the project I'm currently using your package for.
Minor. Just thought I'd mention it.
DeprecationWarning: Invalid 'main' field in '/Users/.../Code/.../app/node_modules/string-sanitizer/package.json' of 'node.js'. Please either fix that or report it to the module author
When running a nodejs project with string sanitizer installed on node version 17.6.0, the following error is output to the console:
(node:5678) [DEP0128] DeprecationWarning: Invalid 'main' field in '[redacted]/node_modules/string-sanitizer/package.json' of 'node.js'. Please either fix that or report it to the module author
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.