@specialblend/callable

0.1.0 • Public • Published

callable

callable ES6 classes

installation

npm i @specialblend/callable

example

import Callable from '@specialblend/callable';

export class CheckYoSelfFoo extends Callable {
    constructor(foo, bar) {
        super();
        this.foo = foo;
        this.bar = bar;
    }
    [Symbol.for('call')](name) {
        return `Yo, ${name}! They say it dont ${this.foo}, but ${this.bar}`;
    }
    getFoo() {
        return this.foo;
    }
    getBar() {
        return this.bar;
    }
}

const check = new CheckYoSelfFoo('be like it is', 'it do!');

// => be like it is
console.log(check.getFoo());

// => be like it is
console.log(check.foo);

// => it do!
console.log(check.getBar());

// => it do!
console.log(check.bar);

// => Yo, foo! They say it dont be like it is, but it do!
console.log(check('foo'));

Readme

Keywords

Package Sidebar

Install

npm i @specialblend/callable

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

3.63 kB

Total Files

5

Last publish

Collaborators

  • __specialblend__