abind
Aubo bind instance methods of classes.
Last updated 2 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install abind 
SYNC missed versions from official npm registry.

abind

Build Status Code Climate Code Coverage npm Version JS Standard

Aubo bind instance methods of classes.

Installation

$ npm install abind --save

Usage

'use strict'

const abind = require('abind')

class Talker {
  constructor (name) {
    const s = this
    s.name = name
    abind(s)
  }

  sayHi () {
    const s = this
    return `Hi, i'm ${s.name}`
  }
}

let { sayHi } = new Talker('Tom')

console.log(sayHi()) // -> Hi, i'm Tom

Signature

abind(instance, options) -> Object

Params

Name Type Description
instance Object Instance to bind
options Object Optional settings
options.proto Object Prototype to bind
options.excludes string[] Names to exclude

License

This software is released under the MIT License.

Links

Current Tags

  • 1.0.3                                ...           latest (2 years ago)

4 Versions

  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2017 © taobao.org |