Beating the boilerplate with elegance. Basic and common methods for your node.js application.
That's temp fork of app-base
If you want to install it use the
user/repo
pattern that npm provides.
npm i tunnckoCore/app-base --save
For more use-cases see the tests
const AppBase = require('app-base').AppBase
// or just use the instance
const app = require('app-base')
app.define('hello', function helloWorld (foo, world) {
console.log('Hello', foo, world)
})
app.hello('bar', 'qux') // => 'Hello bar qux'
Using following libraries, they internally pass
this
(the instance) as first argument.
- delegate-properties
app.delegate(obj)
- adds non-enumerable methods toapp
fromobj
- define-property
app.define(key, value)
- adds non-enumerablekey
toapp
console.log(app) // => AppBase { AppBase: [Function: AppBase] }
console.log(app.delegate) // => [Function: delegateProperties]
console.log(app.define) // => [Function: defineProperty]
Using following libraries:
- delegate-properties
AppBase.delegate(Parent.prototype, proto)
- define-property
AppBase.define(Parent.prototype, key, value)
- static-extend
AppBase.extend(Parent)
console.log(AppBase) // => [Function: AppBase]
console.log(AppBase.delegate) // => [Function: delegate]
console.log(AppBase.define) // => [Function: defineProperty]
console.log(AppBase.extend) // => [Function: extend]
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.