1.0.5 • Published 1 year ago

sure-guard v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

SureGuard.js

Description

Node library for data validation

Installation

To install SureGuard.js, use the following npm command:

npm install sure-guard

Methods

NumberValidator

MethodDescriptionParametersReturn
isNumberChecks if the value is of type number.Nonethis
isMinValueChecks if the value is greater than or equal to a minimum.minValue: numberthis
isMaxValueChecks if the value is less than or equal to a maximum.maxValue: numberthis
isPositiveChecks if the value is positive.Nonethis
isNegativeChecks if the value is negative.Nonethis
isIntegerChecks if the value is an integer number.Nonethis
getResultReturns the result of the validation.Noneboolean

StringValidator

MethodDescriptionParametersReturn
isStringChecks if the value is of type string.Nonethis
isMaxSizeChecks if the string size is less than or equal to a maximum.maxSize: numberthis
isMinSizeChecks if the string size is greater than or equal to a minimum.minSize: numberthis
isEmailChecks if the string is a valid email address.Nonethis
isAlphanumericChecks if the string contains only alphanumeric characters.Nonethis
getResultReturns the result of the validation.Noneboolean

Usage Example

const { validator } = require('sure-guard');

const result1 = validator('hello').string().isEmail().getResult();
// result1 === false

const result2 = validator(123).number().isPositive().getResult();
// result2 === true

Contributing

If you wish to contribute to SureGuard.js, please follow these steps: 1. Fork the project. 2. Create a branch for your contribution (git checkout -b feature/new-feature). 3. Make your desired changes. 4. Commit your changes (git commit -m 'Add new feature'). 5. Push to your branch (git push origin feature/new-feature). 6. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago