@agoric/transform-bang
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -16,19 +16,3 @@ 'use strict'; | ||
// Make idempotent, so we don't layer on top of a BasePromise that is adequate. | ||
let needsShim = false; | ||
for (const method of [ | ||
'get', | ||
'put', | ||
'post', | ||
'delete', | ||
'invoke', | ||
'fapply', | ||
'fcall', | ||
]) { | ||
if (typeof Promise.prototype[method] !== 'function') { | ||
needsShim = true; | ||
break; | ||
} | ||
} | ||
if (!needsShim) { | ||
// Already supports all the methods. | ||
if (typeof Promise.makeHandled === 'function') { | ||
return Promise; | ||
@@ -47,3 +31,3 @@ } | ||
let forwardingHandler; | ||
function relay(p) { | ||
function handler(p) { | ||
return promiseToHandler.get(p) || forwardingHandler; | ||
@@ -56,27 +40,27 @@ } | ||
get(key) { | ||
return relay(this).GET(this, key); | ||
return handler(this).GET(this, key); | ||
}, | ||
put(key, val) { | ||
return relay(this).PUT(this, key, val); | ||
return handler(this).PUT(this, key, val); | ||
}, | ||
delete(key) { | ||
return relay(this).DELETE(this, key); | ||
return handler(this).DELETE(this, key); | ||
}, | ||
post(optKey, args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
invoke(optKey, ...args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
fapply(args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
fcall(...args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
@@ -217,3 +201,3 @@ }), | ||
// Not a Remote, so use the local implementation on the | ||
// Not a handled Promise, so use the local implementation on the | ||
// naked object. | ||
@@ -220,0 +204,0 @@ return localImpl(o, ...args); |
@@ -14,19 +14,3 @@ /** | ||
// Make idempotent, so we don't layer on top of a BasePromise that is adequate. | ||
let needsShim = false; | ||
for (const method of [ | ||
'get', | ||
'put', | ||
'post', | ||
'delete', | ||
'invoke', | ||
'fapply', | ||
'fcall', | ||
]) { | ||
if (typeof Promise.prototype[method] !== 'function') { | ||
needsShim = true; | ||
break; | ||
} | ||
} | ||
if (!needsShim) { | ||
// Already supports all the methods. | ||
if (typeof Promise.makeHandled === 'function') { | ||
return Promise; | ||
@@ -45,3 +29,3 @@ } | ||
let forwardingHandler; | ||
function relay(p) { | ||
function handler(p) { | ||
return promiseToHandler.get(p) || forwardingHandler; | ||
@@ -54,27 +38,27 @@ } | ||
get(key) { | ||
return relay(this).GET(this, key); | ||
return handler(this).GET(this, key); | ||
}, | ||
put(key, val) { | ||
return relay(this).PUT(this, key, val); | ||
return handler(this).PUT(this, key, val); | ||
}, | ||
delete(key) { | ||
return relay(this).DELETE(this, key); | ||
return handler(this).DELETE(this, key); | ||
}, | ||
post(optKey, args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
invoke(optKey, ...args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
fapply(args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
fcall(...args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
@@ -215,3 +199,3 @@ }), | ||
// Not a Remote, so use the local implementation on the | ||
// Not a handled Promise, so use the local implementation on the | ||
// naked object. | ||
@@ -218,0 +202,0 @@ return localImpl(o, ...args); |
@@ -20,19 +20,3 @@ (function (global, factory) { | ||
// Make idempotent, so we don't layer on top of a BasePromise that is adequate. | ||
let needsShim = false; | ||
for (const method of [ | ||
'get', | ||
'put', | ||
'post', | ||
'delete', | ||
'invoke', | ||
'fapply', | ||
'fcall', | ||
]) { | ||
if (typeof Promise.prototype[method] !== 'function') { | ||
needsShim = true; | ||
break; | ||
} | ||
} | ||
if (!needsShim) { | ||
// Already supports all the methods. | ||
if (typeof Promise.makeHandled === 'function') { | ||
return Promise; | ||
@@ -51,3 +35,3 @@ } | ||
let forwardingHandler; | ||
function relay(p) { | ||
function handler(p) { | ||
return promiseToHandler.get(p) || forwardingHandler; | ||
@@ -60,27 +44,27 @@ } | ||
get(key) { | ||
return relay(this).GET(this, key); | ||
return handler(this).GET(this, key); | ||
}, | ||
put(key, val) { | ||
return relay(this).PUT(this, key, val); | ||
return handler(this).PUT(this, key, val); | ||
}, | ||
delete(key) { | ||
return relay(this).DELETE(this, key); | ||
return handler(this).DELETE(this, key); | ||
}, | ||
post(optKey, args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
invoke(optKey, ...args) { | ||
return relay(this).POST(this, optKey, args); | ||
return handler(this).POST(this, optKey, args); | ||
}, | ||
fapply(args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
fcall(...args) { | ||
return relay(this).POST(this, undefined, args); | ||
return handler(this).POST(this, undefined, args); | ||
}, | ||
@@ -221,3 +205,3 @@ }), | ||
// Not a Remote, so use the local implementation on the | ||
// Not a handled Promise, so use the local implementation on the | ||
// naked object. | ||
@@ -224,0 +208,0 @@ return localImpl(o, ...args); |
{ | ||
"name": "@agoric/transform-bang", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "transform-bang", | ||
@@ -32,3 +32,3 @@ "main": "dist/transform-bang.cjs.js", | ||
"dependencies": { | ||
"@agoric/eventual-send": "^0.1.2", | ||
"@agoric/eventual-send": "^0.1.3", | ||
"@agoric/harden": "0.0.4", | ||
@@ -35,0 +35,0 @@ "esm": "^3.2.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37195
655
Updated@agoric/eventual-send@^0.1.3