fluid-class
This Node.js module allows to define fluid classes in a simple, declarative way, without the boilerplate code. Fluid interfaces are similar to the moment.js API, for example.
Install
# NPM $ npm install fluid-class # Yarn $ yarn add fluid-class
Usage
const fluidClass property object = const A = // simple property // property with default value // property with transformer // object property // object property with key // (derives the key from the inner object instead of setting it as a parameter) // methods // do not use arrow notation since we need the context via this method'double' { return this * 2 } var a = a // set property foo to 'doe'a // returns 'doe'a // returns 'john', which is the default valueaa // returns 4aobject'foo' 'bar' // set object property to 'bar'aobject'foo' // returns 'bar' var Inner = { return } aa // returns the object above a // returns 8
License
Unless stated otherwise all works are:
Copyright © Sebastian Landwehr info@dword-design.de
and licensed under: