MCPcopy
hub / github.com/dockersamples/docker-swarm-visualizer / asPromise

Function asPromise

src/utils/request.js:7–9  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

5var wsHost = ((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + window.location.pathname;
6
7function asPromise(fn){
8 return new Promise((resolve,reject) => fn((err,res) => err ? reject(err) : resolve(res)))
9}
10
11function asPromiseAndJSON (fn) {
12 return asPromise(fn).then((res) => res.body);

Callers 1

asPromiseAndJSONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected