Passed
Push — develop ( d4fe34...f94e96 )
by Lorenzo
02:08 queued 13s
created

src/core/decorators/RouterBean.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 18
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 9
mnd 0
bc 0
fnc 1
dl 0
loc 18
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A RouterBean.ts ➔ RouterBean 0 12 1
1
import express from 'express';
2
import { Bean } from '@/core/decorators/Bean';
3
4
/**
5
 * Creates an ExpressBean and a Router for this class
6
 * @param path {string}
7
 * @decorator
8
 */
9
export function RouterBean(path: string) {
10 4
  return (target: any, context: any) => {
11 4
    Bean(target, context);
12 4
    const router = express.Router();
13 4
    Reflect.defineProperty(target.instance, 'routerConfig', {
14 19
      get: () => ({ path, router }),
15
    });
16
  };
17
}
18