@stopify/higher-order-functions
A polyfill for higher-order functions that are compatible with Stopify
Last updated a year ago by arjunguha .
BSD-3-Clause · Original npm · Tarball · package.json
$ cnpm install @stopify/higher-order-functions 
SYNC missed versions from official npm registry.

@stopify/higher-order-functions

JavaScript programs that use native higher-order functions (e.g., Array.prototype.map, Array.prototype.filter, etc.) are not compatible with Stopify, since Stopify cannot instrument native functions to capture continuations. This package provides polyfills for these functions that work with Stopify.

Usage

Before compiling the program with Stopify, use the compiler in this library to call the polyfill functions:

const ast = babylon.parse(code);
const polyfilled = polyfillHofFromAst(ast.program);
const runner = stopify.stopifyLocallyFromAst(polyfilled,
    undefined, compilerOpts, runtimeOpts);

This wraps arrays to call $stopifyArray, which needs to be a global:

runner.g.$stopifyArray: function(array: any) {
    return require('@stopify/higher-order/functions/dist/ts/mozillaHofPolyfill.lazy')
        .stopifyArray(array);
}

Current Tags

  • 0.7.1                                ...           latest (a year ago)

2 Versions

  • 0.7.1                                ...           a year ago
  • 0.7.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |