function-overloader
Advanced tools
Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "function-overloader", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "improve overloading functions and methods in js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -75,2 +75,3 @@ # FUNCTION OVERLOADER | ||
.do((age, name) => name + age) | ||
.execute(...arguments); | ||
} | ||
@@ -112,3 +113,2 @@ | ||
Accept callback function which should be called if previous `.when` match arguments. | ||
Will respond with `Condition Response` | ||
@@ -122,4 +122,2 @@ ### .else() | ||
Return object with `done` method. | ||
### .elseThrow() | ||
@@ -132,4 +130,2 @@ | ||
Return object with `done` method. | ||
### .execute() | ||
@@ -141,7 +137,5 @@ | ||
accept function arguments. It is possible by passing them one by one, but preferred why is to just pass spread `...arguments`. | ||
Will return funtion response | ||
## License | ||
MIT |
@@ -37,3 +37,3 @@ /* eslint-disable no-new-wrappers */ | ||
.do(() => {}) | ||
.else(() => {}); | ||
.elseThrow(() => {}); | ||
expect(elseMethodResult).to.have.property("execute"); | ||
@@ -172,2 +172,15 @@ expect(elseMethodResult).to.not.have.property("when"); | ||
it("should not throw type error when no conditions met", () => { | ||
expect(() => { | ||
Overload.when(Overload.NUMBER, Overload.STRING) | ||
.do(() => "wrong result") | ||
.when() | ||
.do(() => "wrong result") | ||
.when(Overload.NUMBER, Overload.NUMBER) | ||
.do(() => "correct result") | ||
.elseThrow() | ||
.execute(10, 10); | ||
}).to.not.throw(TypeError); | ||
}); | ||
it("return sync result for classes", () => { | ||
@@ -174,0 +187,0 @@ class Test1 {} |
Sorry, the diff of this file is not supported yet
28
633
60647
137