blu

bluebirds

Object oriented Node.js toolset

Showing:

Popularity

Downloads/wk

2

Maintenance

No Maintenance Data Available

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Build Status

BB.js

Object oriented Node.js toolset

Installation

$ npm install bluebirds --save

Usage

var BB = require('bluebirds');

Modules

BB.Object

Core piece of this toolset, BB.Object provides an "Ember" style object model for creating classes.

BB.Object.prototype.init

BB.Object.extend

BB.Object.create

Create your first class :

var Person = BB.Object.extend({
  firstName: '',
  lastName: '',
  
  init: function() {
    if(!this.lastName || !this.firstName) throw new Error('John Doe is a myth');
  },
  
  sayHello: function() {
    console.log('Hello, my name is', this.getFullName());
  },
  
  getFullName: function() {
    return this.firstName + ' ' + this.lastName;
  }
});


var person = Person.create({
  firstName: 'Sylvain',
  lastName: 'Estevez'
});

person.sayHello();
$ Hello, my name is Sylvain Estevez

Extend your class :

var Employee = Person.extend({
  job: '',
  
  sayHello: function() {
    console.log(this._super(), ', I work as a ', this.job);
  }
});


var employee = Employee.create({
  firstName: 'Sylvain',
  lastName: 'Estevez',
  job: 'developer'
});

employee.sayHello();
$ Hello, my name is Sylvain Estevez, I work as a developer

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial