@antcolag/tools
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "@antcolag/tools", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "npm wrapper for tools", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -136,3 +136,5 @@ import { | ||
remove() { | ||
this[HANDLERS] = this[HANDLERS].filter(different.bind(void 0, ...arguments)) | ||
this[HANDLERS] = this[HANDLERS].filter( | ||
different.bind(void 0, ...arguments) | ||
) | ||
return this[HANDLERS].length | ||
@@ -144,3 +146,3 @@ } | ||
return this[HANDLERS].reduce( | ||
async (pre, x) => pre = pre || await x.call(...arguments), | ||
reducer, | ||
null | ||
@@ -151,2 +153,6 @@ ) | ||
function reducer(pre, x){ | ||
return pre || x.call(...arguments) | ||
} | ||
class Handler { | ||
@@ -162,3 +168,3 @@ constructor(id, handler = pipe, ...names){ | ||
return opt && ['string', ...this.names].reduce( | ||
(prev, curr, i) => properties.call(prev, curr, opt[i]), | ||
matcher.bind(opt), | ||
{} | ||
@@ -168,8 +174,12 @@ ) | ||
async call(path, ...args) { | ||
call(path, ...args) { | ||
var opt = this.match(path); | ||
return opt && await this.handler(opt, ...args) | ||
return opt && this.handler(opt, ...args) | ||
} | ||
} | ||
function matcher(prev, curr, i) { | ||
return properties.call(prev, curr, this[i]) | ||
} | ||
/** | ||
@@ -176,0 +186,0 @@ * it allows you to handle a resource with the methods |
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
1216121
2111