castly
Javascript unmarshalling. Copies generic JSON attributes into "fresh" instances complete with methods and prototypes. Easily describe what you expect to come back from the server and it will optionally log or throw when it doesn't match.
Installation
$ npm install is-a
Usage
var myJSON = JSON; { this { return tuple: SpecialTuple flag: typeIsBOOLEAN config1: Config config2: Config ; };} { this { return a: typeIsBOOLEAN b: typeIsBOOLEAN c: typeIsBOOLEAN typeIsUNDEFINED ; }; this { console }} { this { thislength = 3; return { ifattr === '0' return castly; ifattr === '1' return castly; ifattr === '2' return castly; else return castly; } }; this { return "I'm a special tuple " + this; }}SpecialTupleprototype = ; var castly = ;var typeIs = castlytypeIs;castlystrict = true; var myObj = castly;console; //"I'm a special tuple 1---2---three"myObjconfig1; //"undefined"myObjconfig2; //"true"