A better primitive for prototype-based OO.
const Refinable = require('refinable');
const Point2d = Refinable.refine({
x: 0,
y: 0,
toString() {
return this.x + ', ' + this.y
}
});
const p1 = Point2d.refine({ x: 10, y: 10 });
const p2 = p1.refine({ y: 20 });
p1.toString()
// => 10, 10
p2.toString()
// => 10, 20
The officially supported way of getting Refinable is through npm:
$ npm install refinable
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.
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.
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.
Refinable is copyright (c) Quildreen Motta 2016, and released under the MIT licence. See the LICENCE
file in this repository for detailed information.