UNPKG

@u4/adbkit-monkey

Version:

A Node.js interface to the Android monkey tool.

27 lines (26 loc) 767 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS206: Consider reworking classes to avoid initClass * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ class Reply { constructor(type, value) { this.type = type; this.value = value; } isError() { return this.type === Reply.ERROR; } toError() { if (!this.isError()) { throw new Error('toError() cannot be called for non-errors'); } return new Error(this.value); } } exports.default = Reply; Reply.ERROR = 'ERROR'; Reply.OK = 'OK';