# @incpad/decorators

> Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth i

Latest version **1.0.22** (published 2019-02-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install @incpad/decorators
pnpm add @incpad/decorators
yarn add @incpad/decorators
bun add @incpad/decorators
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.22 |
| Published | 2019-02-18 |
| First published | 2019-02-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 59.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | aj0k3r |
| Maintainers | yixuankeer |

## Links

- npm: https://www.npmjs.com/package/@incpad/decorators
- npm.io page: https://npm.io/package/@incpad/decorators

## Dependencies (4)

- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [@incpad/need](https://npm.io/package/@incpad/need.md) ^1.0.22
- [react-native](https://npm.io/package/react-native.md) ^0.57.5
- [lodash.isstring](https://npm.io/package/lodash.isstring.md) ^4.0.1

## Recent versions

- 1.0.22 (latest) — 2019-02-18
- 1.0.21 — 2019-02-13

## README

# `decorators`

> TODO: description

## Usage
定义了一系列的装饰器，来便捷处理各种情况

* aop :实现类函数的AOP处理
```$xslt
const AOP=require("@incpad/decorators/decorators/aop")
class test{
    @AOP({
       beforeFunc:()=>{
            console.log("before")
       },
       afterFunc:()=>{
            console.log("after")
       }
      })
     testMethod(){
        console.log("run")
     }
}
new test().testMethod()

//output:
//before
//run
//after
```

* color:实现色彩的快速处理（目前只实现了部分函数）
```$xslt
const {Hex2Rgba}=require("@incpad/decorators/decorators/color")

const style={
   @Hex2Rgba(50) backgroundColor:#ffffff
}
console.log(style.backgroundColor)
//output:
//"rgba(255,255,255,0.5)"
```

* need:基于@incpad/need工具的装饰器实现
```$xslt
const need=require("@incpad/decorators/decorators/need")
@need("lodash.isstring")
class test{

}
console.log(test)
//output:
//{
// dep:{
//      lodash:{
//          isstring:[Function object]
//      }
//  }
//}
```

* react-native-size:对于RN程序，快速将px转化为pt单位的装饰器  
比如如果设计图上标注宽度为50px，就可以这么写
```$xslt
const size=require("@incpad/decorators/decorators/size")
const style={
    @size("px2pt") width:50
}
```
同样如果是字体，也可以使用fpx2pt:
```$xslt
const size=require("@incpad/decorators/decorators/size")
const style={
    @size("fpx2pt") fontSize:20
}
```

---
_Source: https://npm.io/package/@incpad/decorators · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
