Giter Club home page Giter Club logo

string-sanitizer's Issues

Suggestion: Int/Double sanitization/validation

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.

TypeScript Error TS1046

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"]
    }
  }
}

Invalid 'main' field in package.json

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

Suggestion: Add name validation

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.

Depreciation warning

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

Deprecation Warning

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.