boo
Core prototypical primitives for Object Orientation/Composition.
Last updated 14 years ago by killdream .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install boo 
SYNC missed versions from official npm registry.

Boo Build Status Dependencies Status

Boo provides utilities to structure a program by means of prototypical object orientation and object composition, in an easy way. It provides you with inheritance, composition and mixin facilities, all packaged in a nice API.

var Animal = boo.Base.derive({
  name: 'Unknow'

, say:
  function say(thing) {
    return this.name + ': ' + thing }
})

var Cat = Animal.derive({
  withName:
  function _withName(name) {
    return this.derive({ name: name }) }
})

var nyah = Cat.withName('Nyan Cat')
nyah.say('Nyan nyan nyan~')

Installing

With Node.js and NPM, you can do the easy-modo install:

$ npm install boo
# then require it as usual
node> var boo = require('boo')

In the browser, you have to include the script tag pointing to the boo.js file:

<script src="/path/to/boo.js"></script>
<script type="text/javascript">
  // `boo' is in the global scope now
</script>

Platform support

ES3 and beyond!

browser support

Testing

For Node, just:

$ npm test          # (or make test)

For the browser:

$ npm install -g brofist-browser
$ make browser-test
# Then point your browsers to the URL on yer console.

Benchmarks

There are a few benchmarks you can run:

$ make benchmark

Learning

Boo ships with a full narrated reference manual, covering the concepts and designs you need to know to use the library effectively. You can either read it online, or locally — from the file docs/build/html/index.html.

Additionally, you can read the following introduction to Boo:

Reference

extend(target, mixins...)

Extends the target with the provided mixins, using a right-most precedence rule.

extend: object, mixin... -> object

merge(mixins...)

Like extend, but pure.

merge: mixin... -> object

derive(proto, mixin...)

Constructs a new object that inherits from proto.

derive: object, mixin... -> object

Base:make(...)

Instantiates a new object, and initialises it by calling the init method.

make: @object => A... -> this <| object

Base:derive(mixin...)

Like derive, but the prototype is the this object.

derive: @object => mixin... -> this <| object

Getting support

Boo uses the Github tracker for tracking bugs and new features.

Licence

MIT/X11.

Current Tags

  • 2.0.0                                ...           latest (14 years ago)

8 Versions

  • 2.0.0                                ...           14 years ago
  • 1.2.4                                ...           14 years ago
  • 1.2.3                                ...           14 years ago
  • 1.2.2                                ...           14 years ago
  • 1.2.1                                ...           14 years ago
  • 1.2.0                                ...           15 years ago
  • 1.1.0                                ...           15 years ago
  • 0.1.0                                ...           15 years ago
Maintainers (1)
Downloads
Total 23
Today 0
This Week 7
This Month 14
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE