
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
elo7-validate-amd
Advanced tools
Validate-amd library
validate.js is a small library to help form validation. This library uses amd structure.
It uses html5 form attributes validate specification and works on browsers that does not support html5 validation. Then, we built it from scratch.
npm install elo7-validate-amd
Validate-amd depends on an amd implementation. We suggest async-define implementation for dependency lookup. Validate-amd also depends on doc-amd.
.validateForm(selectorOrDocElement)
Validate the form using almost all the html5 attributes validate spec. Returns a array with the error messages.
selectorOrDocElement: doc-amd object or String //A CSS selector. Note that, if it is a class name with dots, the dots must be escaped. E.g.: doc(".my\\.class")
define(['validate'], function(Validate) {
var validate = new Validate(),
errors = validate.validateForm('#form');
errors.forEach(function(error) {
if (error.message) {
// executes when there are errors
}
});
});
.validateField(selectorOrElements)
Validate individual fields. Returns an object with a error message.
selectorOrDocElement: doc-amd object or String //A CSS selector. Note that, if it is a class name with dots, the dots must be escaped. E.g.: doc(".my\\.class")
define(['validate'], function(Validate) {
var validate = new Validate(),
error = validate.validateField($('input[name=example1]'));
if (error.message) {
// executes when there are errors
}
});
new Validate({ messages: object });
Customize the error messages
object: Object //An object with the properties messages ("required", "min", "max", "maxlength", "pattern", "email" or "url")
define(['validate'], function(Validate) {
var custom_messages = {
'required': 'Field required.',
'min': 'Enter a value greater than or equal to {0}.',
'max': 'Enter a value greater than or equal to {0}.',
'maxlength': 'Enter a value with max length less than or equal to {0}.',
'pattern': 'Enter a valid value.',
'email': 'Enter a valid email address.',
'url': 'Enter a valid url'
}
var validate = new Validate({ messages: custom_messages }),
errors = validate.validateForm('#form');
errors.forEach(function(error) {
if (error.message) {
// executes when there are errors
}
});
});
required: This field is required'
min: 'Please enter a value greater than or equal to {0}'
max: 'Please enter a value greater than or equal to {0}'
maxlength: 'Please enter a value with max length less than or equal to {0}'
pattern: 'Please enter a valid value'
email: 'Please enter a valid email address'
url: 'Please enter a valid url'
Validate-amd is released under the BSD. Have at it.
Copyright :copyright: 2017 Elo7# validate-amd
FAQs
Small library to help form validation
We found that elo7-validate-amd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.