{"_id":"@alanmarcell/ptz-validations","_rev":"3-15125ea9e1a58faa72bf96bd9a9dfc84","name":"@alanmarcell/ptz-validations","description":"Validate your js objects.","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.0":{"name":"@alanmarcell/ptz-validations","version":"0.0.0","description":"Validate your js objects.","main":"dist/index.js","typings":"src/index.ts","scripts":{"lint":"tslint ./src/**/*.ts ./src/**/*.test.ts ./src/**/*.d.ts","js":"rimraf dist-esnext && tsc && rimraf dist && babel dist-esnext -d dist --presets es2015 --source-maps","pretest":"npm-run-all --parallel js lint","mocha":"mocha ./dist/**/*.js --require babel-polyfill","test":"nyc npm run mocha && nyc report --reporter=html --reporter=text-lcov > coverage.lcov && f() { EXIT=0; codecov --token=0c85d3d0-9d6f-4529-a0ba-f0b357f78001 || exit $EXIT; }; f","test:cover":"npm run test && opn ./coverage/index.html","predebug":"npm run pretest","debug":"node --nolazy --debug-brk=5858 dist/index.js","docs:build":"typedoc --out ./docs ./ --includeDeclarations --excludeExternals --exclude '**/*.test.ts'","docs":"npm run docs:build && opn ./docs/index.html"},"repository":{"type":"git","url":"git+https://github.com/polutz/ptz-validations.git"},"author":{"name":"github.com/angeloocana"},"license":"ISC","bugs":{"url":"https://github.com/polutz/ptz-validations/issues"},"homepage":"https://github.com/polutz/ptz-validations#readme","devDependencies":{"@types/mocha":"^2.2.40","@types/node":"^7.0.12","@types/ramda":"^0.24.0","@types/shortid":"0.0.29","babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","babel-preset-es2017":"^6.24.1","codecov":"^2.2.0","istanbul":"^0.4.5","mocha":"^3.4.2","mocha-lcov-reporter":"^1.3.0","npm-run-all":"^4.0.2","nyc":"^11.0.2","opn":"^5.1.0","opn-cli":"^3.1.0","ptz-assert":"^1.6.8","rimraf":"^2.6.1","sinon":"^2.3.5","tslint":"^5.4.3","typedoc":"^0.7.1","typescript":"^2.3.4"},"dependencies":{"ptz-fp":"^1.0.1","ptz-log":"^1.1.0","ramda":"^0.24.1","shortid":"^2.2.8"},"gitHead":"06dbd6d8c337afba9478f4cfa54089189fc0471c","_id":"@alanmarcell/ptz-validations@0.0.0","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"alanmarcell","email":"alanmarcell@live.com"},"dist":{"integrity":"sha512-S2rtIVo0OpJUtHk3AXHd0aam0TQLBppctOd6O15Ra0Y0TAc96olVXqAcSSgllCSOJrxpk0Q3jamBOPvuir47IQ==","shasum":"378a9d87317ca86115557d3a73cfcff8cd0cd9f4","tarball":"https://registry.npmjs.org/@alanmarcell/ptz-validations/-/ptz-validations-0.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDoasHMPVTyRNvjnlBh2yNSbYC60DOci6oQys0cvz8l2AiEArrVfhvU4KHNBDAHZMueP1MeEKry/puY+w8CFn2Gn1iA="}]},"maintainers":[{"name":"alanmarcell","email":"alanmarcell@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ptz-validations-0.0.0.tgz_1498619767706_0.8771211598068476"}},"0.0.1":{"name":"@alanmarcell/ptz-validations","version":"0.0.1","description":"Validate your js objects.","main":"dist/index.js","typings":"src/index.ts","scripts":{"lint":"tslint ./src/**/*.ts ./src/**/*.test.ts ./src/**/*.d.ts","js":"rimraf dist-esnext && tsc && rimraf dist && babel dist-esnext -d dist --presets es2015 --source-maps","pretest":"npm-run-all --parallel js lint","mocha":"mocha ./dist/**/*.js --require babel-polyfill","test":"nyc npm run mocha && nyc report --reporter=html --reporter=text-lcov > coverage.lcov && f() { EXIT=0; codecov --token=0c85d3d0-9d6f-4529-a0ba-f0b357f78001 || exit $EXIT; }; f","test:cover":"npm run test && opn ./coverage/index.html","predebug":"npm run pretest","debug":"node --nolazy --debug-brk=5858 dist/index.js","docs:build":"typedoc --out ./docs ./ --includeDeclarations --excludeExternals --exclude '**/*.test.ts'","docs":"npm run docs:build && opn ./docs/index.html"},"repository":{"type":"git","url":"git+https://github.com/polutz/ptz-validations.git"},"author":{"name":"github.com/angeloocana"},"license":"ISC","bugs":{"url":"https://github.com/polutz/ptz-validations/issues"},"homepage":"https://github.com/polutz/ptz-validations#readme","devDependencies":{"@types/mocha":"^2.2.40","@types/node":"^7.0.12","@types/ramda":"^0.24.0","@types/shortid":"0.0.29","babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","babel-preset-es2017":"^6.24.1","codecov":"^2.2.0","istanbul":"^0.4.5","mocha":"^3.4.2","mocha-lcov-reporter":"^1.3.0","npm-run-all":"^4.0.2","nyc":"^11.0.2","opn":"^5.1.0","opn-cli":"^3.1.0","ptz-assert":"^1.6.8","rimraf":"^2.6.1","sinon":"^2.3.5","tslint":"^5.4.3","typedoc":"^0.7.1","typescript":"^2.3.4"},"dependencies":{"ptz-fp":"^1.0.1","ptz-log":"^1.1.0","ramda":"^0.24.1","shortid":"^2.2.8"},"gitHead":"06dbd6d8c337afba9478f4cfa54089189fc0471c","_id":"@alanmarcell/ptz-validations@0.0.1","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"alanmarcell","email":"alanmarcell@live.com"},"dist":{"integrity":"sha512-ikDEoHyufenJdFHflnE1nAC+D+l/zp5Z3ltjcf0ndFTMzdN7885uVf3ByyELGL7lfWk/dAKB2e5+kz6BbhBgeQ==","shasum":"c96f65aef512440373d9e9f2248768211dfb289e","tarball":"https://registry.npmjs.org/@alanmarcell/ptz-validations/-/ptz-validations-0.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFwd+6kspN69eqlHY1Llo4skXHvFlGwy+kra+dtw4e0GAiEA4qJMqlNeP8K1oecVvWFpMuahM7ECwvVPHeurnhxBsDc="}]},"maintainers":[{"name":"alanmarcell","email":"alanmarcell@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ptz-validations-0.0.1.tgz_1498665898662_0.6191538430284709"}},"0.0.2":{"name":"@alanmarcell/ptz-validations","version":"0.0.2","description":"Validate your js objects.","main":"dist/index.js","typings":"src/index.ts","scripts":{"lint":"tslint ./src/**/*.ts ./src/**/*.test.ts ./src/**/*.d.ts","js":"rimraf dist-esnext && tsc && rimraf dist && babel dist-esnext -d dist --presets es2015 --source-maps","pretest":"npm-run-all --parallel js lint","mocha":"mocha ./dist/**/*.js --require babel-polyfill","test":"nyc npm run mocha && nyc report --reporter=html --reporter=text-lcov > coverage.lcov && f() { EXIT=0; codecov --token=0c85d3d0-9d6f-4529-a0ba-f0b357f78001 || exit $EXIT; }; f","test:cover":"npm run test && opn ./coverage/index.html","predebug":"npm run pretest","debug":"node --nolazy --debug-brk=5858 dist/index.js","docs:build":"typedoc --out ./docs ./ --includeDeclarations --excludeExternals --exclude '**/*.test.ts'","docs":"npm run docs:build && opn ./docs/index.html"},"repository":{"type":"git","url":"git+https://github.com/polutz/ptz-validations.git"},"author":{"name":"github.com/angeloocana"},"license":"ISC","bugs":{"url":"https://github.com/polutz/ptz-validations/issues"},"homepage":"https://github.com/polutz/ptz-validations#readme","devDependencies":{"@types/mocha":"^2.2.40","@types/node":"^7.0.12","@types/ramda":"^0.24.0","@types/shortid":"0.0.29","babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","babel-preset-es2017":"^6.24.1","codecov":"^2.2.0","istanbul":"^0.4.5","mocha":"^3.4.2","mocha-lcov-reporter":"^1.3.0","npm-run-all":"^4.0.2","nyc":"^11.0.2","opn":"^5.1.0","opn-cli":"^3.1.0","ptz-assert":"^1.6.8","rimraf":"^2.6.1","sinon":"^2.3.5","tslint":"^5.4.3","typedoc":"^0.7.1","typescript":"^2.3.4"},"dependencies":{"ptz-fp":"^1.0.1","ptz-log":"^1.1.0","ramda":"^0.24.1","shortid":"^2.2.8"},"gitHead":"c1b808b156185a58fa42a7c527bf3c5832790149","_id":"@alanmarcell/ptz-validations@0.0.2","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"alanmarcell","email":"alanmarcell@live.com"},"dist":{"integrity":"sha512-fys94F2TDZ4A1LatMn6xba7lVOM7NZsTfIKRF4tiGxdr3k7gJ9CBg8whdLXNw/QsoLamM7e/B/jhIIyJzZPu6A==","shasum":"6514c94157b049fcb912756b7dd699f67283ab5c","tarball":"https://registry.npmjs.org/@alanmarcell/ptz-validations/-/ptz-validations-0.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFFtBGGo9ZcIhrX8vVVwnIuBU8AIC/rve59WR2JHZoeQAiAyNLJ01gsJMqRFO2lbdk4/hbyk8Q36TSS7NdzHExF+KQ=="}]},"maintainers":[{"name":"alanmarcell","email":"alanmarcell@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ptz-validations-0.0.2.tgz_1498668620387_0.5491254527587444"}}},"readme":"# ptz-validations\n\n[![Build Status](https://travis-ci.org/polutz/ptz-validations.svg)](https://travis-ci.org/polutz/ptz-validations)\n[![NPM](https://img.shields.io/npm/v/ptz-validations.svg)](https://www.npmjs.com/package/ptz-validations)\n[![codecov.io](http://codecov.io/github/polutz/ptz-validations/coverage.svg)](http://codecov.io/github/polutz/ptz-validations)\n[![Dependency Status](https://gemnasium.com/polutz/ptz-validations.svg)](https://gemnasium.com/polutz/ptz-validations)\n[![bitHound Score](https://www.bithound.io/github/gotwarlost/istanbul/badges/score.svg)](https://www.bithound.io/github/polutz/ptz-validations)\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n\n## Translations\n[pt-br](https://github.com/polutz/ptz-validations/blob/master/README.pt-br.md)\n[en-us](https://github.com/polutz/ptz-validations/blob/master/README.md)\n\nValidate your js objects.\n\n\n## Use\n\n### Install\n```bash\n    npm install --save ptz-validations\n```\n\n### How to use\nExample test of how to create a function to validate user:\n```typescript\n    import * as assert from 'ptz-assert';\n    import * as V from './index';\n\n    describe('ptz-validations', () => {\n        it('createUser example', () => {\n\n            // Optional interface for Typescript projects\n            interface IUser {\n                id: string;\n                userName: string;\n                password: string;\n                email: string;\n                weight?: number;\n                birthday?: Date;\n            }\n\n            const validateUser = V.validate<IUser>({\n                id: [\n                    V.generateId\n                ],\n                displayName: [\n                    V.required,\n                    V.isString,\n                    V.min(2),\n                    V.max(100)\n                ],\n                userName: [\n                    V.required,\n                    V.isString,\n                    V.min(2),\n                    V.max(40),\n                    V.toLowerCase\n                ],\n                password: [\n                    V.required,\n                    V.isString,\n                    V.min(6),\n                    V.max(40)\n                ],\n                email: [\n                    V.required,\n                    V.isEmail\n                ],\n                weight: [\n                    V.isNumber,\n                    V.min(1),\n                    V.max(1000)\n                ],\n                birthday: [\n                    V.isDate,\n                    V.min(new Date('1800-01-01')),\n                    V.max(new Date())\n                ]\n            });\n\n            const user = validateUser({\n                userName: 'angeloocana',\n                password: 'abcd',\n                email: 'angeloocana@gmail.com',\n                weight: 90,\n                birthday: '1992-06-28'\n            });\n\n            const expectedUser = {\n                id: 'hfk397d',\n                userName: 'angeloocana',\n                password: 'abcd',\n                email: 'angeloocana@gmail.com',\n                weight: 90,\n                birthday: new Date('1992-06-28'),\n                errors: [{\n                    propName: 'displayName',\n                    errorMsg: 'ERROR_REQUIRED'\n                }, {\n                    propName: 'password',\n                    errorMsg: 'ERROR_MIN'\n                }]\n            };\n\n            assert.ok(user.id, 'generate id');\n            assert.equal(user.userName, expectedUser.userName, 'set userName');\n            assert.equal(user.password, expectedUser.password, 'set password');\n            assert.equal(user.email, expectedUser.email, 'set email');\n            assert.equal(user.weight, expectedUser.weight, 'set weight');\n            assert.equal(user.birthday.toString(), expectedUser.birthday.toString(), 'set birthday');\n            assert.deepEqual(user.errors, expectedUser.errors, 'add errors');\n        });\n    });\n\n```\n\n## Contribute\n\n### NPM Global packages\n```bash\n    npm install -g ts-node babel-cli\n```\n\n### Setup\n```bash\n    npm install   \n```\n\n### Test\n```bash\n    npm test\n```\n","maintainers":[{"name":"alanmarcell","email":"alanmarcell@live.com"}],"time":{"modified":"2022-04-04T12:33:10.846Z","created":"2017-06-28T03:16:09.100Z","0.0.0":"2017-06-28T03:16:09.100Z","0.0.1":"2017-06-28T16:04:58.888Z","0.0.2":"2017-06-28T16:50:20.553Z"},"homepage":"https://github.com/polutz/ptz-validations#readme","repository":{"type":"git","url":"git+https://github.com/polutz/ptz-validations.git"},"author":{"name":"github.com/angeloocana"},"bugs":{"url":"https://github.com/polutz/ptz-validations/issues"},"license":"ISC","readmeFilename":"README.md"}