{"_id":"@akinon/criteria","_rev":"1-d3cbaa11249bbb342fb3614095e99744","name":"@akinon/criteria","dist-tags":{"latest":"1.0.5-rc.3"},"versions":{"1.0.5-rc.3":{"name":"@akinon/criteria","version":"1.0.5-rc.3","description":"Apply rulesets for your password fields","main":"Criteria/scripts/Criteria.js","scripts":{"dev":"webpack --mode=development","watch":"webpack --watch --mode=development","production":"NODE_ENV=production webpack --mode=production","fix-js":"eslint-auto-fix","build":"babel src --presets babel-preset-env --out-dir Criteria","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/cfkarakulak/CriteriaJS.git"},"keywords":["password","criteria","validation"],"author":{"name":"Cemre Fatih Karakulak"},"license":"WTFPL","bugs":{"url":"https://github.com/cfkarakulak/CriteriaJS/issues"},"contributors":[{"name":"Cemre Fatih Karakulak","email":"cradexco@gmail.com","url":"https://github.com/cfkarakulak"},{"name":"Muhammed Bacalan","email":"muhammedbacalan@gmail.com","url":"https://github.com/mbacalan"}],"homepage":"https://github.com/cfkarakulak/CriteriaJS#readme","peerDependencies":{"jquery":">=1.8.0"},"devDependencies":{"@babel/core":"^7.5.5","@babel/preset-env":"^7.5.5","babel-cli":"^6.26.0","babel-loader":"^8.0.6","babel-preset-env":"^1.7.0","css-loader":"^1.0.0","eslint":"^5.3.0","eslint-auto-fix":"^1.0.0","eslint-config-airbnb-base":"^13.2.0","eslint-loader":"^2.2.1","eslint-plugin-import":"^2.18.2","less":"^3.8.0","less-loader":"^4.1.0","mini-css-extract-plugin":"^0.4.1","style-loader":"^0.21.0","webpack":"^4.38.0","webpack-cli":"^3.1.0","braces":">=2.3.1"},"dependencies":{"jquery":">=1.8.0"},"gitHead":"1579e4a75080962d9283b2b16f85d3cc1182e58d","_id":"@akinon/criteria@1.0.5-rc.3","_nodeVersion":"12.7.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-fxTktmQ6uUfCnxb/sUqm/BtN5YrvRbqc3pRnnpAUAZhuEP7KMgPpuyT97y036DPGXesIqPIMJ0kEm0mlKupX9Q==","shasum":"4437ebc773c48decd6a2c253c56f65badf2f28de","tarball":"https://registry.npmjs.org/@akinon/criteria/-/criteria-1.0.5-rc.3.tgz","fileCount":38,"unpackedSize":62718,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdrrOBCRA9TVsSAnZWagAAIq0P/2SKtEcDyYQTd5J5zQrH\nyNm1WK5JwDuQRyTJAwpN9IdG2GjM/AjhE87nz97OcUPEYt2u4ZBYCWeHzFJX\ncJm9oRLSHobsIKuXYvadXsOveDiJ7KdKMWeAzx5k2GEvCL1EZl7osOGVPgGS\nsscvYQ7Hmq2nEmplNLpCir/ySPq5rWciOApjtXLG3E+KL1F3bHPP0YQr0C3R\nLMEZKwGtv2sDG79XulGJOfVV2r1LR0AKRG/xQQKoTqMlkiCpu7mG4pmStCRF\neyktnTrAXVbV47Pxf3Zx5UWBDuW4Dw841x/Wjko/dJqbuV9q/jdoz0os0NEV\nr4nHKw7h3WfjveI1PzGoxd4EjfhW6fEvK37l+60R8PnCx1AqQDn3j+Y0OJBb\nXzOORsuOhSAG1bUAHtR63F04/pZHEdrj0SKbl8PRR/MxF1xRsrlmYm/uG734\nM6QuVt8h4tEuDY/uvSrYzFjnX5602uXMk2T3vcN/mRy2qQBI1JQMLM7lhKKZ\nyOKx3cKsvWtxzPu2pprRCFamHMp6Z4QG+TdTY7Whk9/ZjC5i6sDYjFei4o+y\ntfkP/5xrR3yxoGChe6tEoqYfEkkd/uLA3+7LU/ewZyNIH8v192fuCdrXe1j4\nvyn2dvoqRTGomZN062LRAHCrK3UMv3bvHuwCSr3qCcDoQZr8LnB7os+9Ph2J\nLg8Q\r\n=QGuR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICUTYgI+0oZKyekpyVkDtf9vO46JlwYQmFlPG4qksk6EAiBBT/1Z140jInBECBqtvOt5pQ6R5cs4AjHriJtm6Akowg=="}]},"maintainers":[{"name":"akinon","email":"cemre.karakulak@akinon.com"}],"_npmUser":{"name":"akinon","email":"cemre.karakulak@akinon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/criteria_1.0.5-rc.3_1571730305103_0.9651275321442687"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-22T07:45:04.808Z","1.0.5-rc.3":"2019-10-22T07:45:05.266Z","modified":"2022-04-04T12:29:32.695Z"},"maintainers":[{"name":"akinon","email":"cemre.karakulak@akinon.com"}],"description":"Apply rulesets for your password fields","homepage":"https://github.com/cfkarakulak/CriteriaJS#readme","keywords":["password","criteria","validation"],"repository":{"type":"git","url":"git+https://github.com/cfkarakulak/CriteriaJS.git"},"contributors":[{"name":"Cemre Fatih Karakulak","email":"cradexco@gmail.com","url":"https://github.com/cfkarakulak"},{"name":"Muhammed Bacalan","email":"muhammedbacalan@gmail.com","url":"https://github.com/mbacalan"}],"author":{"name":"Cemre Fatih Karakulak"},"bugs":{"url":"https://github.com/cfkarakulak/CriteriaJS/issues"},"license":"WTFPL","readme":"### criteriaJS\nApply pre-defined rules to your password fields.\n\n#### Install Using Package Managers\n\n```sh\n# Bower\nbower install --save criteriajs\n\n# NPM\nnpm install criteriajs\n```\n\n#### Import Library\n\n```javascript\nimport 'criteriajs';\n```\n\n#### Register Global Rules\n\nRules are pretty self-explanatory.\nLength rule has a type of range (min-max) while the rest\nonly checks for single value (min)\n\n```javascript\nconst criteria = $('input[data-criteria]').criteria({\n  rules: {\n    length: [6, 15],\n    contains: {\n      alphabetical: 1,\n      numerical: 1,\n      lowercase: 1,\n      uppercase: 1,\n      special: 1,\n    },\n  },\n  initialize: ($element) => {},\n  change: ($element, attributes) => {\n    Object.values(attributes.rules).every(rule => rule === true);\n  },\n  focus: ($element, attributes) => {},\n  blur: ($element) => {},\n});\n```\n\n#### Using Data Attribute\n\nIf you wish to register criteria per element instead of globally,\njust omit the rules object, add data-criteria attribute to your inputs\nand seperate each rule with a pipe (|).\n\nExample:\n\n```html\n<input type=\"password\" data-criteria=\"length:6-15|alphabetical:1|numerical:1|uppercase:2|lowercase:3\">\n<input type=\"password\" data-criteria=\"length:4-20|numerical:3|uppercase:1|special:3\">\n```\n\n```javascript\nconst criteria = $('input[data-criteria]').criteria({\n  initialize: ($element) => {},\n  change: ($element, attributes) => {\n    // console.log($element, attributes);\n  },\n  focus: ($element, attributes) => {},\n  blur: ($element) => {},\n});\n```\n\n#### When to Enable / Disable Form Submit\n\nYou should disable the form from being submitted by adding ```disabled```\nattribute to the button beforehand, and remove the attribute when all criteria are matched.\nA simple check can be used to determine whether all of the rules you wish to validate are satisfied or not.\n\n```javascript\nObject.values(attributes.rules).every(rule => rule === true);\n```\n\n#### Setting up development environment\n\nYou can go ahead and play around with ```src/example/index.html``` after running the commands below.\n\n```\n# 1. fetch project\ngit clone git@github.com:cfkarakulak/CriteriaJS.git\n\n# 2. change directory to criteriajs and install dependencies\nnpm install\n\n# 3. compile and listen for changes\nnpm run watch\n```\n\n#### Settings\n\nRule | Type | Default | Description\n------ | ---- | ------- | -----------\nlength | array | [6, null] | Checks whether the value of the target element has a length between min and max. Use `[6, null]` if you wish to disable maximum check.\nalphabetical | integer | null | Checks whether the value has at least n number of alphabetical characters. `Latin Alphabet`\nnumerical | integer | null | Checks whether the value has at least n number of numerical characters. `[0-9]`\nlowercase | integer | null | Checks whether the value has at least n number of lowercase characters. `[a-z]`\nuppercase | integer | null | Checks whether the value has at least n number of uppercase characters. `[A-Z]`\nspecial | integer | null | Checks whether the value has at least n number of special characters. `[!,@,#,%,$,%]`\n","readmeFilename":"README.md"}