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

function-overloader

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-overloader - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

package.json
{
"name": "function-overloader",
"version": "1.1.0",
"version": "1.2.0",
"description": "improve overloading functions and methods in js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -176,4 +176,12 @@ # FUNCTION OVERLOADER

## Debugger
For easy debug this library run your script with
```
DEBUG=Overloader <command to run>
```
## License
MIT

@@ -0,1 +1,2 @@

import debug from "debug";
/**

@@ -12,3 +13,5 @@ * Class representing helper for methods for simplify overloading

constructor() {
this._debug = debug("overloader");
this._args = Array.from(arguments);
this._debug("constructor get arguments ", this._args);
this._enabled = true;

@@ -26,2 +29,3 @@ this._result = null;

when() {
this._debug("when", Array.from(arguments));
let checkCondition = false;

@@ -44,7 +48,13 @@ if (arguments.length === 0 && this._args.length === 0) {

}
this._debug("result", checkCondition);
return {
do: callback => {
this._debug("do");
if (checkCondition && this._enabled) {
this._debug("execute function");
this._enabled = false;
this._result = callback(...this._args);
let result = callback(...this._args);
this._debug("function sync result", result);
this._result = result;
}

@@ -51,0 +61,0 @@ return this;

Sorry, the diff of this file is not supported yet

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