1.1.0 • Published 7 years ago

spb25-device v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Device

Base class for random devices

Example

const Device = require('spb25-device');

const random = x => Math.floor(Math.random() * x);

class RandomNatural extends Device {
    next (limit) {
        return super.next(random(limit));
    }
    init (limit) {
        return super.init(limit);
    }
}

let die = new RandomNatural(10);

die.derive().then(console.log); // '6'

Install

npm install spb25-device

API

  • .derive()

License

MIT License

1.1.0

7 years ago

1.0.0

7 years ago