Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proxymise

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxymise - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

23

index.js
const proxymise = (target) => {
switch (typeof target) {
case 'function': {
return new Proxy(target, handler);
}
case 'object': {
const proxy = () => target;
proxy.__proxy__ = true;
return new Proxy(proxy, handler);
}
default: {
return target;
}
if (typeof target === 'object') {
const proxy = () => target;
proxy.__proxy__ = true;
return new Proxy(proxy, handler);
}
return typeof target === 'function' ? new Proxy(target, handler) : target;
};

@@ -21,7 +14,5 @@

if (target.__proxy__) target = target();
if (property !== 'then' && property !== 'catch' && typeof target.then === 'function') {
return proxymise(target.then(value => get(value, property, receiver)));
}
return proxymise(get(target, property, receiver));

@@ -33,7 +24,5 @@ },

if (target.__proxy__) target = target();
if (typeof target.then === 'function') {
return proxymise(target.then(value => Reflect.apply(value, thisArg, argumentsList)));
}
return proxymise(Reflect.apply(target, thisArg, argumentsList));

@@ -46,5 +35,5 @@ }

const value = typeof target === 'object' ? Reflect.get(target, property, receiver) : target[property];
return typeof value === 'function' ? value.bind(target) : value;
return typeof value === 'function' && typeof value.bind === 'function' ? value.bind(target) : value;
};
module.exports = proxymise;
{
"name": "proxymise",
"version": "1.0.0",
"version": "1.0.1",
"description": "Chainable Promise Proxy",

@@ -5,0 +5,0 @@ "repository": "https://github.com/kozhevnikov/proxymise",

@@ -5,7 +5,7 @@ # Proxymise

Lightweight no-dependencies ES6 [promise] [proxy] allowing you to drop non-stop `then()` or `await`
and chain.
Lightweight ES6 [Proxy] for [Promises] with no additional dependencies. Proxymise allows for method
and property chaining without need for intermediate `then()` or `await` for cleaner and simpler code.
[proxy]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
[promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
[Proxy]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
[Promises]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

@@ -39,5 +39,5 @@ ## Use

## Examples
## Practical Examples
- [fetch with JSON](https://github.com/kozhevnikov/proxymise/blob/master/test/fetch.test.js)
- [Selenium WebDriverJS with Page Objects](https://github.com/kozhevnikov/proxymise/blob/master/test/selenium.test.js)
- [Fetch and JSON parsing](https://github.com/kozhevnikov/proxymise/blob/master/test/fetch.test.js)
- [Selenium WebDriverJS and Page Objects](https://github.com/kozhevnikov/proxymise/blob/master/test/selenium.test.js)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc