UNPKG

restructer

Version:

The restructer library is a type-safe encoder/decoder up to one level for objects.

18 lines (15 loc) 404 B
// Instantiate the library const restructer = require('./'); // Have the object you wish to re-construct const myObject = { name: 'John Doe', age: 32, hasJob: false, jobTitle: null, } // Convert to string const myObjectStr = restructer.encode(myObject); console.log(myObjectStr); // Convert back from string const myObjectStrObject = restructer.decode(myObjectStr); console.log(myObjectStrObject);