New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html5-form-validator

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html5-form-validator - npm Package Compare versions

Comparing version

to
1.0.0

2

dist/index.min.js

@@ -1,1 +0,1 @@

(function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={exports:{}};b(c.exports),a.index=c.exports}})(this,function(a){"use strict";function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var e=function(){function a(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.querySelector("form"),d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};b(this,a),this.settings=Object.assign({},{errorElement:"error",invalidClass:"invalid",submitHandler:null,validateOnInput:!0},d),this.form=c,this.errorDiv="<div class=\"".concat(this.settings.errorElement,"\"></div>"),this.init()}return d(a,[{key:"init",value:function b(){var a=this;this.form.noValidate=!0,this.settings.validateOnInput&&this.validateAll(this.form),this.form.onsubmit=function(b){a.validateAll(a.form),a.form.checkValidity()?"function"==typeof a.settings.submitHandler&&(b.preventDefault(),a.settings.submitHandler(a)):b.preventDefault()}}},{key:"validateAll",value:function i(a){var b=a.querySelectorAll("[required]"),c=!0,d=!1,e=void 0;try{for(var f,g,h=b[Symbol.iterator]();!(c=(f=h.next()).done);c=!0)g=f.value,this.validateField(g)}catch(a){d=!0,e=a}finally{try{c||null==h.return||h.return()}finally{if(d)throw e}}}},{key:"validateField",value:function c(a){var b=this;a.nextSibling.classList&&a.nextSibling.classList.contains(this.settings.errorElement)||a.insertAdjacentHTML("afterend",this.errorDiv),a.oninvalid=function(){a.classList.add(b.settings.invalidClass),a.nextSibling.textContent=a.validationMessage},a.oninput=function(){a.nextSibling.textContent="",a.classList.remove(b.settings.invalidClass),a.checkValidity()}}}]),a}();a.default=e});
(function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={exports:{}};b(c.exports),a.index=c.exports}})(this,function(a){"use strict";function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var e=/*#__PURE__*/function(){function a(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.querySelector("form"),d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};b(this,a),this.settings=Object.assign({},{errorElement:"error",invalidClass:"invalid",submitHandler:null,validateOnInput:!0},d),this.form=c,this.errorDiv="<div class=\"".concat(this.settings.errorElement,"\"></div>"),this.init()}return d(a,[{key:"init",value:function b(){var a=this;this.form.noValidate=!0,this.settings.validateOnInput&&this.validateAll(this.form),this.form.onsubmit=function(b){a.validateAll(a.form),a.form.checkValidity()?"function"==typeof a.settings.submitHandler&&(b.preventDefault(),a.settings.submitHandler(a)):b.preventDefault()}}},{key:"validateAll",value:function i(a){var b=a.querySelectorAll("[required]"),c=!0,d=!1,e=void 0;try{for(var f,g,h=b[Symbol.iterator]();!(c=(f=h.next()).done);c=!0)g=f.value,this.validateField(g)}catch(a){d=!0,e=a}finally{try{c||null==h.return||h.return()}finally{if(d)throw e}}}},{key:"validateField",value:function c(a){var b=this;a.nextSibling.classList&&a.nextSibling.classList.contains(this.settings.errorElement)||a.insertAdjacentHTML("afterend",this.errorDiv),a.oninvalid=function(){a.classList.add(b.settings.invalidClass),a.nextSibling.textContent=a.validationMessage},a.oninput=function(){a.nextSibling.textContent="",a.classList.remove(b.settings.invalidClass),a.checkValidity()}}}]),a}();a.default=e});
{
"name": "html5-form-validator",
"version": "0.4.0",
"description": "The most simple HTML5 form validator",
"main": "dist/index.js",
"scripts": {
"dist": "babel src/index.js --out-file dist/index.js",
"minify": "babel src/index.js --out-file dist/index.min.js --presets minify,@babel/env",
"build": "npm run dist && npm run minify"
},
"repository": {
"type": "git",
"url": "git+https://github.com/scriptex/html5-form-validator.git"
},
"keywords": [
"HTML5",
"form",
"validator"
],
"author": "Atanas Atanasov <scriptex.bg@gmail.com> (https://atanas.info)",
"license": "MIT",
"bugs": {
"url": "https://github.com/scriptex/html5-form-validator/issues"
},
"homepage": "https://github.com/scriptex/html5-form-validator#readme",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.51",
"@babel/core": "^7.0.0-beta.51",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.54",
"@babel/plugin-proposal-decorators": "7.0.0-beta.54",
"@babel/plugin-proposal-export-namespace-from": "7.0.0-beta.54",
"@babel/plugin-proposal-function-sent": "7.0.0-beta.54",
"@babel/plugin-proposal-json-strings": "7.0.0-beta.54",
"@babel/plugin-proposal-numeric-separator": "7.0.0-beta.54",
"@babel/plugin-proposal-throw-expressions": "7.0.0-beta.54",
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.54",
"@babel/plugin-syntax-import-meta": "7.0.0-beta.54",
"@babel/plugin-transform-modules-umd": "^7.0.0-rc.1",
"@babel/preset-env": "^7.0.0-beta.51",
"babel-loader": "^8.0.0-beta.0",
"babel-minify": "^0.4.3"
}
"name": "html5-form-validator",
"version": "1.0.0",
"description": "The simplest HTML5 forms validator",
"main": "dist/index.js",
"scripts": {
"dist": "babel src/index.js --out-file dist/index.js",
"minify": "babel src/index.js --out-file dist/index.min.js --presets minify,@babel/env",
"build": "npm run dist && npm run minify"
},
"repository": {
"type": "git",
"url": "git+https://github.com/scriptex/html5-form-validator.git"
},
"keywords": [
"HTML5",
"form",
"validator"
],
"author": "Atanas Atanasov <scriptex.bg@gmail.com> (https://atanas.info)",
"license": "MIT",
"bugs": {
"url": "https://github.com/scriptex/html5-form-validator/issues"
},
"homepage": "https://github.com/scriptex/html5-form-validator#readme",
"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.2.3",
"@babel/plugin-proposal-decorators": "7.2.3",
"@babel/plugin-proposal-export-namespace-from": "7.2.0",
"@babel/plugin-proposal-function-sent": "7.2.0",
"@babel/plugin-proposal-json-strings": "7.2.0",
"@babel/plugin-proposal-numeric-separator": "7.2.0",
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"@babel/plugin-transform-modules-umd": "7.2.0",
"@babel/preset-env": "7.2.3",
"babel-loader": "8.0.4",
"babel-minify": "0.5.0"
}
}

@@ -9,3 +9,2 @@ [![GitHub release](https://img.shields.io/github/release/scriptex/html5-form-validator.svg)](https://github.com/scriptex/html5-form-validator/releases/latest)

[![Analytics](https://ga-beacon.appspot.com/UA-83446952-1/github.com/scriptex/html5-form-validator/README.md)](https://github.com/scriptex/html5-form-validator/)
[![Greenkeeper badge](https://badges.greenkeeper.io/scriptex/html5-form-validator.svg)](https://greenkeeper.io/)

@@ -18,3 +17,3 @@ # HTML5 Form Validator

```console
```sh
npm i html5-form-validator

@@ -25,3 +24,3 @@ ```

```console
```sh
yarn add html5-form-validator

@@ -28,0 +27,0 @@ ```

Sorry, the diff of this file is not supported yet