{"_id":"ts-typed-json","_rev":"903816","name":"ts-typed-json","description":"JSON types and utilities for TypeScript.","dist-tags":{"latest":"0.3.2"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"time":{"modified":"2021-09-20T13:46:36.000Z","created":"2017-04-26T06:59:55.812Z","0.3.2":"2020-08-01T19:35:53.077Z","0.3.1":"2020-07-26T05:56:27.254Z","0.3.0":"2020-07-26T05:13:42.934Z","0.2.2":"2017-04-28T22:28:24.749Z","0.2.1":"2017-04-28T13:57:19.836Z","0.2.0":"2017-04-28T07:46:06.449Z","0.1.0":"2017-04-26T06:59:55.812Z"},"users":{},"author":{"name":"Dave Herman","email":"david.herman@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"versions":{"0.3.2":{"name":"ts-typed-json","version":"0.3.2","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepare":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"david.herman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"@types/node":"^14.0.26","typescript":"^3.9.7"},"dependencies":{},"gitHead":"ab6e9ca3f898a58ed4bb1d1f7d6e261f40bbe2c8","_id":"ts-typed-json@0.3.2","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","dist":{"shasum":"f4f20f45950bae0a383857f7b0a94187eca1b56a","size":4526,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.3.2.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmUser":{"name":"dherman","email":"david.herman@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-typed-json_0.3.2_1596310552889_0.5983578113680539"},"_hasShrinkwrap":false,"publish_time":1596310553077,"_cnpm_publish_time":1596310553077},"0.3.1":{"name":"ts-typed-json","version":"0.3.1","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepare":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"david.herman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"@types/node":"^14.0.26","typescript":"^3.9.7"},"dependencies":{},"gitHead":"5654b48a41e76a3b0c19a84f09034fbf734ee24d","_id":"ts-typed-json@0.3.1","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","dist":{"shasum":"af6bfb2b65a6977e9be6ba693eaa58429567bc25","size":4554,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.3.1.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmUser":{"name":"dherman","email":"david.herman@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-typed-json_0.3.1_1595742987128_0.44474694096421596"},"_hasShrinkwrap":false,"publish_time":1595742987254,"_cnpm_publish_time":1595742987254},"0.3.0":{"name":"ts-typed-json","version":"0.3.0","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepare":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"david.herman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"@types/node":"^14.0.26","typescript":"^3.9.7"},"dependencies":{},"gitHead":"025da59a3f268d392a8d68123c3889bd745037cc","_id":"ts-typed-json@0.3.0","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","dist":{"shasum":"9c7941ed0a4d07ed98ec01a0ae1ec4f0cdbf9c90","size":4329,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.3.0.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmUser":{"name":"dherman","email":"david.herman@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-typed-json_0.3.0_1595740422829_0.029928420496688535"},"_hasShrinkwrap":false,"publish_time":1595740422934,"_cnpm_publish_time":1595740422934},"0.2.2":{"name":"ts-typed-json","version":"0.2.2","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"dherman@mozilla.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"@types/es6-promise":"0.0.32","@types/rsvp":"^3.3.0","ts-dict":"^0.1.1","typescript":"^2.3.1"},"dependencies":{"rsvp":"^3.5.0"},"gitHead":"a1be67cf1ddc0099b4956e52638e98e091b52d49","_id":"ts-typed-json@0.2.2","_shasum":"53184bee893e45991b73c8c463a38b59e27cd47e","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"dherman","email":"dherman@mozilla.com"},"dist":{"shasum":"53184bee893e45991b73c8c463a38b59e27cd47e","size":3983,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.2.2.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ts-typed-json-0.2.2.tgz_1493418502815_0.618870145175606"},"directories":{},"publish_time":1493418504749,"_cnpm_publish_time":1493418504749,"_hasShrinkwrap":false},"0.2.1":{"name":"ts-typed-json","version":"0.2.1","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"dherman@mozilla.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"@types/es6-promise":"0.0.32","@types/rsvp":"^3.3.0","ts-dict":"^0.1.1","typescript":"^2.3.1"},"dependencies":{"rsvp":"^3.5.0"},"gitHead":"be242df2062d3f817059d42682f21621b575e6f5","_id":"ts-typed-json@0.2.1","_shasum":"93e1042815b0ca718f157e76e72fdf208f908477","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"dherman","email":"dherman@mozilla.com"},"dist":{"shasum":"93e1042815b0ca718f157e76e72fdf208f908477","size":3458,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.2.1.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ts-typed-json-0.2.1.tgz_1493387838112_0.7764235849026591"},"directories":{},"publish_time":1493387839836,"_cnpm_publish_time":1493387839836,"_hasShrinkwrap":false},"0.2.0":{"name":"ts-typed-json","version":"0.2.0","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"dherman@mozilla.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"ts-dict":"^0.1.1","typescript":"^2.3.1"},"gitHead":"a2dfd16fbca74ecf14c0eee1b83116b2e09bf32d","_id":"ts-typed-json@0.2.0","_shasum":"aa457453d2bad52a3ba9e9f9175392f288fcfc70","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"dherman","email":"dherman@mozilla.com"},"dist":{"shasum":"aa457453d2bad52a3ba9e9f9175392f288fcfc70","size":2224,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.2.0.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ts-typed-json-0.2.0.tgz_1493365564541_0.12181025836616755"},"directories":{},"publish_time":1493365566449,"_cnpm_publish_time":1493365566449,"_hasShrinkwrap":false},"0.1.0":{"name":"ts-typed-json","version":"0.1.0","description":"JSON types and utilities for TypeScript.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc"},"repository":{"type":"git","url":"git+https://github.com/dherman/ts-typed-json.git"},"author":{"name":"Dave Herman","email":"dherman@mozilla.com"},"license":"MIT","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"homepage":"https://github.com/dherman/ts-typed-json#readme","devDependencies":{"ts-dict":"^0.1.1","typescript":"^2.2.2"},"gitHead":"50a1761a0ac8e1acc0265d1d43d1fdd4b9b2740c","_id":"ts-typed-json@0.1.0","_shasum":"dacca4bf18676fe0056022206622746630588daa","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"dherman","email":"dherman@mozilla.com"},"dist":{"shasum":"dacca4bf18676fe0056022206622746630588daa","size":2192,"noattachment":false,"key":"/ts-typed-json/-/ts-typed-json-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ts-typed-json/download/ts-typed-json-0.1.0.tgz"},"maintainers":[{"name":"dherman","email":"dherman@mozilla.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ts-typed-json-0.1.0.tgz_1493189993700_0.9870749937836081"},"directories":{},"publish_time":1493189995812,"_cnpm_publish_time":1493189995812,"_hasShrinkwrap":false}},"readme":"# Typed JSON\n\nThis library is a set of type definitions and utilities\nfor dealing with JSON data in a type-safe way with TypeScript.\n\nThe most important type definitions are `JSON.Value`, `JSON.Object`,\nand `JSON.Array`, which correspond respectively to JSON values,\nobjects, and arrays, as the names suggest.\n\nThe library also exports safely-typed versions of the standard `JSON.parse()` and `JSON.stringify()` functions.\n\n# Basic Usage\n\n```ts\nimport * as JSON from 'ts-typed-json';\n```\n\n# Types\n\n## interface JSON.Object\n\n```ts\ninterface JSON.Object extends Record<string, JSON.Value> {}\n```\n\n## interface JSON.Array\n\n```ts\ninterface JSON.Array extends Array<JSON.Value> {}\n```\n\n## type JSON.Value\n\n```ts\ntype JSON.Value = null | boolean | number | string | JSON.Object | JSON.Array;\n```\n\n# Type Testing API\n\n## function JSON.isNull(x: JSON.Value): x is null\n\nTests if a JSON value is `null`.\n\n## function JSON.isBoolean(x: JSON.Value): x is boolean\n\nTests if a JSON value is a boolean.\n\n## function JSON.isNumber(x: JSON.Value): x is number\n\nTests if a JSON value is a number.\n\n## function JSON.isString(x: JSON.Value): x is string\n\nTests if a JSON value is a string.\n\n## function JSON.isObject(x: JSON.Value): x is JSON.Object\n\nTests if a JSON value is a JSON object.\n\n## function JSON.isArray(x: JSON.Value): x is JSON.Array\n\nTests if a JSON value is a JSON array.\n\n# Type Cast API\n\n## function JSON.asNull(x: JSON.Value, prefix?: string): null\n\nCasts a JSON value to `null`, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n## function JSON.asBoolean(x: JSON.Value, prefix?: string): boolean\n\nCasts a JSON value to a boolean, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n## function JSON.asNumber(x: JSON.Value, prefix?: string): number\n\nCasts a JSON value to a number, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n## function JSON.asString(x: JSON.Value, prefix?: string): string\n\nCasts a JSON value to a string, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n## function JSON.asObject(x: JSON.Value, prefix?: string): JSON.Object\n\nCasts a JSON value to a JSON object, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n## function JSON.asArray(x: JSON.Value, prefix?: string): JSON.Array\n\nCasts a JSON value to a JSON array, throwing a `TypeError` if it fails.\n\nThe optional `prefix` argument allows callers to provide a contextual\nstring describing the value that is being tested, for the sake of\ngenerating useful error messages in the case of a type error.\n\n\n# Serialization and Deserialization API\n\n## function parse(source: string): JSON.Value\n\nParses a source string as a JSON value.\n\n## function stringify(value: JSON.Value): string\n\nSerializes a JSON value to a string.\n\n## function loadSync(path: string, encoding: BufferEncoding = 'utf8'): JSON.Value\n\nSynchronously loads a JSON value from the filesystem.\n\n## function load(path: string, encoding: BufferEncoding = 'utf8'): Promise<JSON.Value>\n\nAsynchronously loads a JSON value from the filesystem.\n","_attachments":{},"homepage":"https://github.com/dherman/ts-typed-json#readme","bugs":{"url":"https://github.com/dherman/ts-typed-json/issues"},"license":"MIT"}