spb25-device

1.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i spb25-device

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • cheoshn