@mongodb-model/base

0.0.10 • Public • Published

Base

Base is a duplex stream, specifically a Transform stream with some functionalities added. Primarily it uses full power of the NodeJs Transform Stream API. In other words, everything you can do with NodeJs Transform API you can do with base! Base is centrally very highly event driven.

Installation

$ yarn add @mongodb-model/base

or

$ npm i @mongodb-model/base

Simple Usage Examples

Making api request (http request)

 const Base = require('@mongodb-model/base');
 const base = new Base();
 base.apiGet(); //base.apiGet(your api endpoint)
 base.on('apiGet', data => console.log(data));
 base.on('apiGet-error', error => console.error(error));
 

By extension

 class MyWonderfulClass extends require('@mongodb-model/base') {

    constructor(...arrayOfObjects) {

    super({ objectMode: true, encoding: "utf-8", autoDestroy: true });

    arrayOfObjects.forEach(option => {
        if(Object.keys(option).length > 0){
            Object.keys(option).forEach((key) => { if(!this[key]) this[key] = option[key];})
        }
    });

    this.autobind(MyWonderfulClass);
    this.autoinvoker(MyWonderfulClass);
    this.setMaxListeners(Infinity);
  }
 };
 

Author's Info

Website NPM Github Gitlab Blog LinkedIn Facebook Twitter Instagram
Website NPM Github Gitlab Blog LinkedIn Facebook Twitter Instagram

/@mongodb-model/base/

    Package Sidebar

    Install

    npm i @mongodb-model/base

    Weekly Downloads

    0

    Version

    0.0.10

    License

    MIT

    Unpacked Size

    170 kB

    Total Files

    18

    Last publish

    Collaborators

    • eweah
    • afrosintech