{"_id":"@buggyorg/dynatype","_rev":"38-683f5b28d18445d4c73b91d8612ee3a7","name":"@buggyorg/dynatype","description":"A dynamic type implementation.","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@buggyorg/dynatype","version":"0.1.0","description":"A dynamic type implementation.","main":"lib/dynatype.js","directories":{"test":"test"},"scripts":{"test":"node node_modules/standard/bin/cmd.js src/**/*.js && gulp && node_modules/mocha/bin/mocha --compilers js:babel/register"},"keywords":["Type","Dynamic"],"author":{"name":"Maximilian Klein"},"license":"MIT","devDependencies":{"babel":"^5.8.29","babel-eslint":"^4.1.3","chai":"^3.4.0","gulp":"^3.9.0","gulp-babel":"^5.3.0","mocha":"^2.3.3","standard":"^5.3.1"},"standard":{"parser":"babel-eslint"},"gitHead":"d0a48ab8879480ffc807c3fdba8f22c042a56ed8","_id":"@buggyorg/dynatype@0.1.0","_shasum":"540a857273ec08a5a282f55f63146ac638586fea","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.2","_npmUser":{"name":"buggyorg","email":"dasmaxl@gmail.com"},"dist":{"shasum":"540a857273ec08a5a282f55f63146ac638586fea","tarball":"https://registry.npmjs.org/@buggyorg/dynatype/-/dynatype-0.1.0.tgz","integrity":"sha512-X1siYjUfZByuLVOO/6F3vzf2bZVUkr5UCKNPA+gIOrPqORHuavDoy4J6qarmtNVAaTfdvxCU7o2huKRY7iAVhw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEUC8ZU9rmqL1RScR19VimIxoNPa9/wTYbz8zmUfi5IzAiEAlP8MT+B6znFYzpTc3moGP5cP0FOckOgA/ivkV02XjQ8="}]},"maintainers":[{"name":"buggyorg","email":"dasmaxl@gmail.com"}]}},"readme":"# Dynatype\n\nA dynamic datatype is a meta construct that abstracts\nthe data represented by a datatype. It is possible\nto define datatypes and define relations between those.\n\n# Usage\n\nThe API is separated into descriptors and translators.\n\n## Descriptor\n\nThe descriptor API is usable via\n\n```js\nvar descriptor = require('dynatype').descriptor\n```\n\nIt offers the following functions\n\n| function | description |\n|----------|-------------|\n| `create(name, data)` | Create a new dynatype descriptor. It always must have a unique name. The data object contains information about the structure of the type. It is a JS object. |\n| `typename(dynatype)` | Get the name of a dynatype descriptor instance |\n| `hasProperty(dynatype, property)` | Returns whether the dynatype defines the property `property` |\n| `datatype(dynatype, property)` | Returns the datatype of the dynatype property. |\n\n### Data Format\n\nThe data object for a descriptor has a special structure. It\nis a mapping between the name of the property and its type. They type can be one of the following\n\n - `\"number\"`\n - `\"bool\"`\n - `\"string\"`\n - `\"array\"` this requires the extra field `arraytype` for the array datatype. We don't support mixed arrays.\n - Other descriptors. Recursive definitions are not supported.\n\nA descriptor could look like this:\n\n```js\nvar pointXY = descriptor.create('PointXY', {\n  'x': 'number',\n  'y': 'number'\n})\n```\n\n## Translator\n\nA translator defines a method of translating one datatype into another. Consider this example:\n\n```js\nvar pointXY = /*...*/\nvar pointRPhi = descriptor.create('PointRPhi', {\n  'r': 'number',\n  'phi': 'number'\n})\nvar translator = translator.create(pointXY, pointRPhi, {/*...*/})\n```\n\nthis creates a translator that defines some way of translating a point given in XY coordinates into a point given in polar coordinates. The data that describes the translation is specific to the system it is used in. The dynatype libraries do only store\nthis information but never touch it.\n","maintainers":[{"email":"alex@fasib.de","name":"fasib"},{"email":"legomaik@gmail.com","name":"lemaik"},{"email":"dasmaxl@gmail.com","name":"littlehelicase"}],"time":{"modified":"2022-06-12T15:32:53.632Z","created":"2015-10-28T13:44:44.530Z","0.1.0":"2015-10-28T13:44:44.530Z"},"keywords":["Type","Dynamic"],"author":{"name":"Maximilian Klein"},"license":"MIT","readmeFilename":"README.md"}