let once = (fns, called) => fns.map(orig => (...args) => called ? null : ((called = true), orig(...args)));
export class Promise {
constructor(resolver) {
resolver(v => !this.state && this.assim(v, (s, v) => this._changeState(s, v)),
err => !this.state && this._changeState("rej", err));
}
assim(value, cb, state = "ful") {
let [res, rej] = once([v => this.assim(v, cb), e => this.assim(e, cb, "rej")]);
try {
let then = value && value.then, thenable = typeof then === "function" && Object(value) === value;