@aomex/middleware
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @aomex/middleware | ||
## 0.0.3 | ||
### Patch Changes | ||
- [`59ef917`](https://github.com/aomex/aomex/commit/59ef917533293301e8f3ab82460c8efc07df27c3) Thanks [@geekact](https://github.com/geekact)! - feat(middleware): chain.split 支持传递数组类型的分割点 | ||
- Updated dependencies [[`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9)]: | ||
- @aomex/helper@0.0.3 | ||
## 0.0.2 | ||
@@ -4,0 +13,0 @@ |
@@ -65,3 +65,3 @@ interface _PureFn { | ||
*/ | ||
static split(chain: Chain, point?: string): Chain<object>; | ||
static split(chain: Chain, point?: string | string[]): Chain<object>; | ||
protected readonly SubClass: new (middlewareList?: Middleware[]) => Chain; | ||
@@ -68,0 +68,0 @@ protected points: Record<string, number>; |
@@ -9,2 +9,3 @@ var __defProp = Object.defineProperty; | ||
// src/chain.ts | ||
import { toArray } from "@aomex/helper"; | ||
var _Chain = class { | ||
@@ -48,6 +49,7 @@ constructor(middlewareList = []) { | ||
*/ | ||
static split(chain2, point) { | ||
if (!point || !chain2.points[point]) | ||
static split(chain2, point = []) { | ||
const longestLengthOfPoint = toArray(point).map((p) => chain2.points[p]).filter(Boolean).sort((a, b) => b - a)[0]; | ||
if (!longestLengthOfPoint) | ||
return chain2; | ||
const middlewareList = chain2.middlewareList.slice(chain2.points[point]); | ||
const middlewareList = chain2.middlewareList.slice(longestLengthOfPoint); | ||
return new chain2.SubClass(middlewareList); | ||
@@ -54,0 +56,0 @@ } |
{ | ||
"name": "@aomex/middleware", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -26,3 +26,6 @@ "type": "module", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@aomex/helper": "^0.0.3" | ||
}, | ||
"scripts": {} | ||
} |
Sorry, the diff of this file is not supported yet
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
17315
197
1
+ Added@aomex/helper@^0.0.3
+ Added@aomex/helper@0.0.3(transitive)
+ Addedchalk@5.3.0(transitive)