Socket
Socket
Sign inDemoInstall

validate-fields-body

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.1.3

dist/index.js

10

package.json
{
"name": "validate-fields-body",
"version": "1.1.2",
"version": "1.1.3",
"description": "Validate-Fields-Body is a Javascript library for dealing with validation.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc"
},

@@ -23,3 +24,6 @@ "repository": {

},
"homepage": "https://github.com/nerosengtianthr/validate-body-fields#readme"
"homepage": "https://github.com/nerosengtianthr/validate-body-fields#readme",
"devDependencies": {
"typescript": "^4.9.5"
}
}

@@ -17,4 +17,11 @@ # Validate-Fields-Body

const fieldsValidate = ["username", "email", "password"];
const [isValid, logs, result] = useValidate(fieldsValidate, req.body);
const poolBody = {
username: "JohnDoe",
email: "john@example.com",
password: "1234",
};
const [isValid, logs, result] = useValidate(fieldsValidate, poolBody);
// isValid: return Boolean

@@ -30,3 +37,12 @@ // logs: return Array

// Required value in username and password
const fieldsValidate = ["!username", "!password", "email"];
const poolBody = {
username: "",
email: "john@example.com",
password: "",
};
const [isValid, logs, result] = useValidate(fieldsValidate, req.body);

@@ -46,3 +62,13 @@

// Matching Types : string number...
const fieldsValidate = ["!username:string", "password:string", "age:number"];
const poolBody = {
username: "johnDoe",
email: "john@example.com",
password: "123",
age: 18,
};
const [isValid, logs, result] = useValidate(fieldsValidate, req.body);

@@ -49,0 +75,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc