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

iaop

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iaop

将函数进行aop封装的库

latest
Source
npmnpm
Version
2.0.5
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

what's this

这是一个js工具库,用来帮助你在函数执行前后插入操作(aop编程);

##api https://imsasa.github.io/iaop/index.html

how to use

有函数 fnlog.

function fn(arg) {
  console.log("fn");
  return arg;
}
function log(arg){
    arg++;
    console.log("log:",arg);
}

安装

  npm i https://github.com/imsasa/iaop.git

使用方式

  • 方式1
import {before} from 'iaop';
let beforeFn=before(fn,log);
beforeFn();
  • 方式2
import 'iaop'
let fn=()=>console.log('dosth');
let wrapFn=fn.before(log);
wrapFn();

api

  • before, 在函数执行前增加一个执行函数;
  • after, 在函数执行后增加一个执行函数;
  • pip, 在函数执行后增加一个执行函数fn,fn的入参是将前一个函数的执行结果;
  • fitler, 在函数执行前增加一个执行函数fn,如果fn返回false则不执行函数;
  • unshift, 在函数执行前增加一个执行函数fn,fn的执行结果是函数的入参;
  • co , 函数可并发执行;

FAQs

Package last updated on 09 Oct 2023

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