Code Monkey home page Code Monkey logo

expressjs-check's Introduction

Looks like someone has made their way to my profile. Greetings. Please enjoy the following non-exhaustive list of personal skills and interests:

  • ๐Ÿ” Cybersecurity & Pentesting
  • ๐Ÿ•ธ Web Development
  • ๐Ÿ•น Retro Consoles & Gaming Hardware
  • ๐Ÿ‘พ Emulation, Romhacking & Game Modding
  • โ†ฉ Reverse Engineering & Decompilation
  • โŒจ Programming Languages (in order of self-observed skill, highest to lowest):
    • JavaScript / TypeScript
    • C#
    • Java
    • Python
    • GBZ80 Assembly
    • EVIL
    • C
    • PHP
    • Lua
  • ๐Ÿ’ป Frameworks & other things I don't count as programming languages:

expressjs-check's People

Contributors

hacktix avatar

Watchers

 avatar

expressjs-check's Issues

regexFlags Property for Strings

Currently the flags used for regex checking are set by the library and cannot be changed. A regexFlags property could be useful in various cases.

Array types for all datatypes

Implement an array type for all currently implemented datatypes.
Also the properties that can apply for those types should be checked for any element in the array

If property for all other properties

The possibility to use a if for all properties that exist, e.g. min, max, minLength, maxLength, pattern, ...

It should still be possible to pass a normal value that should always be used, for example:

testNumber: {
	required: true,
	type: 'number',
	min: 10
}

It should also be possible to pass an array instead of a value that applies one/multiple options, for example:

testNumber: {
	required: true,
	type: {
		if: '3 === 3',
		value: 'number'
	}, 
	min: [{
		value: 5,
		ifCondition: '#minNumber === 5'
	}, {
		value: 10,
		ifCondition: '#minNumber === 10'
	}, {
		value: 0 // without an if property it works like ifCondition was true (effectively an else condition)
	}]
}

Add custom error message and response code

In the same structure as stated in #7 add a property customError: string and customStatusCode: integer.

Also only one error message (the first that occurs) should be included.
Example usage:

It should also be possible to pass an array instead of a value that applies one/multiple options, for example:

testNumber: {
	required: true,
	type: {
		if: '3 === 3',
		value: 'number',
		customError: 'Not a number',
		customStatusCode: 409
	}, 
	min: [{
		value: 5,
		ifCondition: '#minNumber === 5'
		customError: 'Not greater than 5',
		customStatusCode: 400
	}, {
		value: 10,
		ifCondition: '#minNumber === 10'
	}, {
		value: 0 // without an if property it works like ifCondition was true (effectively an else condition)
	}]
}

fixedLength Property for Strings

Currently it's only possible to set minimum and maximum length for strings, however, it may be useful in some cases to only allow a fixed length of characters for a string.

Regex Issues

Checking for the regex ([0-1][0-9]|2[0-3]):[0-5][0-9] yields incorrect results. This is possibly due to issues regarding regex groups, as the checker may be checking for the group match rather than a full match.

default property

A default property that is set on the object when the property is not specified/undefined.
For example:

testNumber: {
	required: false,
	type: 'number',
	min: 10,
	default: 15
}

If the proerty testNumber is not provided/undefined it is set to the value 15.

parseDate property

The type must be set to date to use this property.
Default value is false.
If this property is set to true and the string passed can be parsed it is replaced by a date object of the string.

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.