Sha256: 841f51818b64aca7ea0f95b0851ec7a2abb27bee0018ae2906a9805a451ed820

Contents?: true

Size: 344 Bytes

Versions: 22

Compression:

Stored size: 344 Bytes

Contents

module.exports = thunkyp

function thunkyp (fn) {
  let running = null

  return ready

  function ready () {
    if (running) return running
    const p = fn()
    if (!(p instanceof Promise)) running = Promise.resolve(p)
    else running = p
    running.catch(onerror)
    return running
  }

  function onerror () {
    running = null
  }
}

Version data entries

22 entries across 21 versions & 7 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/thunky/promise.js
disco_app-0.18.0 test/dummy/node_modules/thunky/promise.js
disco_app-0.18.2 test/dummy/node_modules/thunky/promise.js
disco_app-0.16.1 test/dummy/node_modules/thunky/promise.js
disco_app-0.15.2 test/dummy/node_modules/thunky/promise.js
disco_app-0.18.4 test/dummy/node_modules/thunky/promise.js
disco_app-0.18.1 test/dummy/node_modules/thunky/promise.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/thunky/promise.js
disco_app-0.14.0 test/dummy/node_modules/thunky/promise.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/thunky/promise.js
tang-0.2.1 spec/tang_app/node_modules/thunky/promise.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/thunky/promise.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/thunky/promise.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/thunky/promise.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/thunky/promise.js
tang-0.2.0 spec/tang_app/node_modules/thunky/promise.js
tang-0.1.0 spec/tang_app/node_modules/thunky/promise.js
tang-0.0.9 spec/tang_app/node_modules/thunky/promise.js
enju_library-0.3.8 spec/dummy/node_modules/thunky/promise.js
ilog-0.4.1 node_modules/thunky/promise.js