function fulfill(value) {
    return Promise({
        "when": function () {
            return value;
        },
        "get": function (name) {
            return value[name];
        },
        "set": function (name, rhs) {
            value[name] = rhs;
        },
        "delete": function (name) {
            delete value[name];
        },
        "post": function (name, args) {
            // Mark Miller proposes that post with no name should apply a
            // promised function.
            if (name === null || name === void 0) {
                return value.apply(void 0, args);
            } else {
                return value[name].apply(value, args);
            }
        },
        "apply": function (thisp, args) {
            return value.apply(thisp, args);
        },
        "keys": function () {
            return object_keys(value);
        }
    }, void 0, function inspect() {
        return { state: "fulfilled", value: value };
    });
}
The async function is a decorator for generator functions, turning
them into asynchronous generators.  Although generators are only part
of the newest ECMAScript 6 drafts, this code does not cause syntax
errors in older engines.  This code should continue to work and will
in fact improve over time as the language improves.

ES6 generators are currently part of V8 version 3.19 with the
--harmony-generators runtime flag enabled.  SpiderMonkey has had them
for longer, but under an older Python-inspired form.  This function
works on both kinds of generators.

Decorates a generator function such that:
 - it may yield promises
 - execution will continue when that promise is fulfilled
 - the value of the yield expression will be the fulfilled value
 - it returns a promise for the return value (when the generator
   stops iterating)
 - the decorated function returns a promise for the return value
   of the generator or the first rejected promise among those
   yielded.
 - if an error is thrown in the generator, it propagates through
   every following yield until it is caught, or until it escapes
   the generator function altogether, and is translated into a
   rejection for the promise returned by the decorated generator.