m10rten / validatees Goto Github PK
View Code? Open in Web Editor NEW✅Validation library for ES6+ projects
Home Page: https://www.npmjs.com/package/validatees
License: MIT License
✅Validation library for ES6+ projects
Home Page: https://www.npmjs.com/package/validatees
License: MIT License
I'm thinking of renaming this package to something more catchy and easier to expand.
for example with CLI of more utils other then validation.
first thought: @jelly/core
packages then could contain: CLI, serverside config, test tools, validation, tree builder.
without having 1 massive package, users can choose what they need.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Checking if a variable is unique within an array can be a struggle.
That is why there will be this function: isUnique
where users can pass any array and value equal to the arrays typed interface.
Input
What parameters will be passed in or required?
And what is the prefered type of input?
An array to check on.
A value to check with.
Output
What will be the expected output?
And what type does it have?
boolean
Additional context
Add any other context or code-examples about the feature request here.
When using this function, the user must know what the return type is, and what it will check on: whatever put in as array, the value given as 2nd.
Example:
isUnique([{a:1}, {b:2}], {c:3}); // true
isUnique(["hello", "world"], "hi"); // true
isUnique({a:1, b:"b"}, {a: "b"}); // true
isUnique({a:1, b:"b"}, {a: "1"}); // true
isUnique({a:1, b:"b"}, {b: "b"}); // false
// etc etc
Validates a phone number based on the incoming input.
Input: number or string, begin with 0 means string.
Optional parameter for pattern/ length with an object, defaulted.
Returns boolean.
Example:
IsValidPhoneNumber("075123456"); // true
Option to add multiple callbacks for the VListener.
like this:
vListener.registerArrayListeners([
{ array: arr1, callbacks: [isTruthy, isValidDate], { strict: true } },
{ array: arr2, callback: isFalsyExtended, { condition: false } },
]);
Is your feature request related to a problem? Please describe.
Input
same as array listener, add map listeners to validate on arrays
Output
boolean value and .set when OK
Additional context
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is:
User input an Array or Object and check if it has been frozen / closed for modification.
Input
What parameters will be passed in or required?
And what is the prefered type of input?
Value: Array or Object or Object based instance like String or Number or Function.
Output
What will be the expected output?
And what type does it have?
Returns boolean.
Additional context
Add any other context or code-examples about the feature request here.
IsExtendable({}); // true.
Const obj = new Object()
obj.freeze(); // or equivalent
IsExtendable(obj); // false.
Is your feature request related to a problem? Please describe.
Input
Output
boolean
Additional context
www.
is not required.Check if the given date format in string or new Date type, is a valid date.
Returns boolean.
Input value: Date | string.
Optional input for format: default to dd-mm-yyyy.
Example:
IsValidDate("12-2-22"); // true
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
isSymbol
, even though not very well known, symbols are part of the node/javascript stack and mostly used in dated versions of EcmaScript.
Input
What parameters will be passed in or required?
And what is the prefered type of input?
any parameter
Output
What will be the expected output?
And what type does it have?
boolean
Additional context
Add any other context or code-examples about the feature request here.
Currently the CLI is being tested by hand and good faith.
To improve this it should be tested with jest within the current test folder.
This most likely will require a folders structure change for the test folder since we now have lib and cli folders.
Checks if given string matches the given pattern.
Input: password
Optional input: password check parameters: numbers, specialChars, length.
Returns boolean.
Is your feature request related to a problem? Please describe.
Input
Output
date
validated.Additional context
Whenever a version is on: lets say: 0.1.0 on NPM
And we try to push a package.json with 0.1.0, it will not fail because it is up to date with NPM.
To fix this: we need to make a new file in the root like we did with replace script file.
then run this in the CI file.
The CLI for checking version, help command, etc etc
Types take up a lot of space in the package.
To improve this, types need to moved to the @types/validatees package to be created seperately.
creation of a validatees/core package/folder is to split te core feature from the less relevant feature.
users should be able to choose either the validatees/core or the full validatees version.
@types/validatees
should include all, and there will be no @types/validatees/core because it will be not worth it.
Check if given input matches with a preset of regex sets, such as only string, only specialChars, only numbers, or mixed.
Input: text, string to check on regex.
Optional input with default: regex pattern.
Can be combined to test for text or/and numbers or/and special characters.
Like this:
isRegexMatch("abc", [PATTERNS.STRING, PATTERNS.SPECIALCHARS])
naming of optional parameters can be improved.
Is your feature request related to a problem? Please describe.
The typescript compiler does not compute with the checks, so need to return valid return values other then boolean.
Input
None
Output
Variable is {} for example
Additional context
Generic V-Listener
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
isRegExp should check if the input is a regex expression
Input
What parameters will be passed in or required?
And what is the prefered type of input?
any input is allowed
Output
Additional context
isRegExp("/0-9/"); //false
When passing an object with values that are undefined or null, it should not return false because thats not how this function should work.
In that way an option parameter can be passed to tell the function to either do or do not behave a certain way.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Register a listener to changes on every array and validate the input, if input is not valid it should not be added to the array.
this way users do not have to validate each time they want to add something to the array, just add a listener and some patterns or functions(from validatees) and never touch it again.
Input
What parameters will be passed in or required?
And what is the prefered type of input?
patterns or callback functions, can be from validatees, can be user-made.
Output
What will be the expected output?
And what type does it have?
None, this is a "worker" like instance.
idea to throw error when validation fails.
idea to return full array when validation is OK.
Additional context
Add any other context or code-examples about the feature request here.
register the instance on startup, never touch it again.
validatees.registerListener([{array1, isTruthy},{array2, isString}, {object1, {password: isValidPassword, email: isValidEmail}]);
// for example, many ways to do this.
validatees.registerArrayListener(isTruthy);
// truthy values may get added in this example.
naming can be improved.
Is your feature request related to a problem? Please describe.
check if a port is running on localhost
Input
cli command
Output
either called as function and returns boolean / throws on ci
Additional context
requires node
Check if given string object is a valid string for an email construction.
Input: string, like new String(), String and string.
Returns boolean
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.