New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tms-flow

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tms-flow

lightweight flow engine

latest
npmnpm
Version
0.0.8
Version published
Maintainers
1
Created
Source

支持流水线方式

import { Pipeline } from './pipeline.js'

new Pipeline()
  .use(function (req, res, next) {
    res.x = 'hello'
    next()
  })
  .use(function (req, res, next) {
    res.y = 'world'
    next()
  })
  .run({}, {}, function (err: Error | null, req: any, res: any) {
    console.log('res', res)
  })

pipeline 可以嵌套

只支持线性执行

流水线中的方法执行上下文绑定为流水线

use方法指定要执行的节点,所有节点函数的参数是一样的

run方法启动流水线

流水线将next方法作为最后一个参数传给节点函数

流水线内部有个step指定当前的执行位置

要求流水线中的节点函数主动调用next方法,驱动流水线继续执行

同步、异步问题

FAQs

Package last updated on 09 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts