{"name":"io-ts-types","version":"0.2.5-rc","description":"A collection of runtime types for use with io-ts","files":["lib"],"main":"lib/index.js","typings":"lib/index.d.ts","scripts":{"lint":"tslint src/**/*.ts test/**/*.ts","mocha":"TS_NODE_CACHE=false mocha -r ts-node/register test/*.ts","prettier":"prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"","fix-prettier":"prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test}/**/*.ts\"","test":"npm run lint && npm run prettier && npm run mocha","clean":"rm -rf lib/*","build":"npm run clean && tsc"},"repository":{"type":"git","url":"git+https://github.com/gcanti/io-ts-types.git"},"author":{"name":"Giulio Canti","email":"giulio.canti@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/gcanti/io-ts-types/issues"},"homepage":"https://github.com/gcanti/io-ts-types","dependencies":{"fp-ts":"^1.0.0-rc","io-ts":"^0.9.8-rc","monocle-ts":"^0.5.3-rc","newtype-ts":"^0.1.0"},"devDependencies":{"@types/mocha":"2.2.38","@types/node":"7.0.4","mocha":"3.2.0","prettier":"1.8.2","ts-node":"3.2.1","tslint":"4.4.2","tslint-config-standard":"4.0.0","typescript":"2.6.2"},"tags":["io-ts","fp-ts","monocle-ts","newtype-ts"],"keywords":["io-ts","fp-ts","monocle-ts","newtype-ts"],"readme":"A collection of runtime types and combinators for use with [io-ts](https://github.com/gcanti/io-ts)\n\n# API\n\n## `newtype-ts`\n\n### `fromNewtype`\n\nGiven\n\n```ts\nimport { Newtype, iso } from 'newtype-ts'\n\ntype Age = Newtype<'Age', number>\n```\n\nI want to define a runtime type whose derived type is\n\n```ts\ntype Person = {\n  name: string\n  age: Age\n}\n```\n\nSolution\n\n```ts\nimport * as t from 'io-ts'\nimport { fromNewtype } from 'io-ts-types/lib/newtype-ts/fromNewtype'\n\nconst Person = t.interface({\n  name: t.string,\n  age: fromNewtype<Age>(t.Integer)\n})\n```\n\nUsage example\n\n```ts\nimport { iso } from 'newtype-ts'\nimport { Lens } from 'monocle-ts'\n\ntype Person = t.TypeOf<typeof Person>\n\nconst ageLens = Lens.fromProp<Person, 'age'>('age').composeIso(iso<Age>())\n\nconst sum = (a: number) => (b: number) => a + b\n\nconsole.log(t.validate({ name: 'Giulio', age: 43 }, Person).map(ageLens.modify(sum(1))))\n// => right({ name: 'Giulio', age: 44 })\n```\n","readmeFilename":"README.md","gitHead":"66f2ebbb7254f90ce582d0173a42f979e8cfa25b","_id":"io-ts-types@0.2.5-rc","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"gcanti","email":"giulio.canti@gmail.com"},"dist":{"integrity":"sha512-CLEraE7wkz8NBQIZzy0bLqFYvt8XoMeBViuIPlFzxwBJeQCurAygik+TiSoRA+SfL6CY7kyyjoByElYopWh9Sw==","shasum":"e709c4ad372ec751a004055efab87b2f69b549bb","tarball":"http://registry-npm.ywwl.com/io-ts-types/download/io-ts-types-0.2.5-rc.tgz","fileCount":91,"unpackedSize":41104,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTwNW/Mv8m+GADduH4aeuFw3rHKxM8cRnVIZwrOCNZeAiEA9Zhrk6EwIM6G3J/JBpIlhtS48BNk/AFDUJ+KayrPAiM="}],"size":10622,"noattachment":false,"key":"/io-ts-types/-/io-ts-types-0.2.5-rc.tgz"},"maintainers":[{"name":"gcanti","email":"giulio.canti@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/io-ts-types_0.2.5-rc_1518015084327_0.2711483307283806"},"_hasShrinkwrap":false,"publish_time":1518015085108,"_cnpm_publish_time":1518015085108,"dist-tags":{"latest":"0.5.19","next":"0.3.5","old-version-0.4.x":"0.4.8"}}