struct-type
A restricted Struct type for JavaScript.
Example
const struct = ;const t = structtypes; const Point2d = ; // Make new instances with `.make`const p1 = Point2d;const p2 = Point2d; // Update fields with `set<Field>`. // This constructs a new prototype-based shallow copy (with Object.create):const p1_2 = p1;p1; // ==> { x: 1, y: 2 }p1_2; // ==> { x: 2, __proto__: p1 } // Flatten structs into regular objects to pass to APIs expecting regular JS objects:p1_2;// ==> { x: 2, y: 2, __proto__: null } // Each struct gets its own type function:const Line = ; const line = Line;
Installation
The officially supported way of getting Refinable is through npm:
$ npm install struct-type
NOTE
If you don't have npm, you'll need to install Node.js in your system before installing Refinable.
A tool like Browserify or Webpack can be used to run Refinable in platforms that don't implement Node-style modules, like the Browser.
Supported platforms
Refinable is supported in all platforms that support ECMAScript 5.
NOTE
For platforms that don't support ECMAScript 5, (like IE8 and 9) the es5-shim library can be used to provide the additional runtime support.
Support
If you think you've found a bug in the project, or want to voice your frustration about using it (maybe the documentation isn't clear enough? Maybe it takes too much effort to use?), feel free to open a new issue in the Github issue tracker.
Pull Requests are welcome. By submitting a Pull Request you agree with releasing your code under the MIT licence.
You can join the Gitter Channel for quick support. You may also contact the author directly through email, or Twitter.
Note that all interactions in this project are subject to Origami Tower's Code of Conduct.
Licence
struct-type is copyright (c) Quildreen Motta 2016, and released under the MIT licence. See the LICENCE
file in this repository for detailed information.