-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
276 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# objectpropvalidator changelog | ||
|
||
|
||
## Version 1.0.0 (January 23, 2022)-Initial Release | ||
* Upload and public release the initial version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Example 1 || objectpropvalidator :: Developed by MAMEDUL ISLAM</title> | ||
</head> | ||
<body> | ||
|
||
I need a function for Object prop validation where it takes input object similar to props | ||
where each key is the name of an expected property, and each value may contain information | ||
about the type, required, and validator for that property. | ||
|
||
Output: returns a new validator function which itself takes an object as an input and | ||
returns true or false depending on whether the object conforms to the schema. | ||
|
||
Additionally, when the value is false the function should log a helpful error | ||
message specific to the mode of failure. | ||
|
||
<br> | ||
<br> | ||
<a href='https://github.com/mamedul/objectpropvalidator/wiki'>Documentations</a> | ||
<br> | ||
<a href='https://mamedul.github.io/dev-projects/objectpropvalidator/'>Project Homepage</a> | ||
<br> | ||
<a href='https://mamedul.github.io'>Developer</a> | ||
|
||
|
||
|
||
<script src="../src/objectpropvalidator-v1.0.0.min.js"></script> | ||
|
||
<script> | ||
|
||
// We check this data validity | ||
var data = { | ||
"props": { | ||
"user": { | ||
"name": "MAMEDUL ISLAM", | ||
"age": 26 | ||
} | ||
} | ||
}; | ||
|
||
// Validation object | ||
var validationObject = { props: { | ||
user: { | ||
type: Object, | ||
required: true, | ||
validator: objectPropValidator({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
age: { | ||
type: Number, | ||
required: true, | ||
validator(value) { | ||
return value > 0; | ||
}, | ||
}, | ||
}), | ||
}, | ||
} | ||
}; | ||
|
||
// Configurations | ||
var config = { | ||
enabled: true, // Configuration enabled | ||
logLevel: 'log' // suggestion show via console.log | ||
}; | ||
|
||
|
||
objectPropValidator(validationObject,config)(data); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "objectpropvalidator", | ||
"version": "1.0.0", | ||
"description": "Simple and smallest fine object properties validation checker with suggestions using console.", | ||
"main": "./src/objectpropvalidator-v1.1.0.min.js", | ||
"directories": { | ||
"doc": "docs", | ||
"example": "examples" | ||
}, | ||
"scripts": { | ||
"test": "objectpropvalidator" | ||
}, | ||
"keywords": [ | ||
"objectpropvalidator", | ||
"objectpropvalidator", | ||
"Javascript", | ||
"Javascript Object", | ||
"Object Validator", | ||
"Object Validation", | ||
"Object Property", | ||
"Object Properties", | ||
"Object Property Validator", | ||
"Object Properties Validator", | ||
"Object Property Validation", | ||
"Object Properties Validation", | ||
"Object Properties Validation Function", | ||
"Object Properties Validation Fast Function", | ||
"Object Properties Validation Function with Suggestion", | ||
"Library", | ||
"Framework", | ||
"mamedul", | ||
"momedul", | ||
"mamedul islam", | ||
"momedul islam", | ||
"www.mamedul.ml", | ||
"Freelancer", | ||
"Developer", | ||
"Javascript Developer", | ||
"Bangladesh" | ||
], | ||
"author": "MAMEDUL ISLAM", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/mamedul/objectpropvalidator.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mamedul/objectpropvalidator/issues" | ||
}, | ||
"homepage": "https://mamedul.github.io/dev-projects/objectpropvalidator/" | ||
} | ||
|
Oops, something went wrong.