提交 57c4cea1 编写于 作者: 码梦天涯's avatar 码梦天涯

add to git

上级 41233c82
export interface IDecorator {
(clazz: object, name: string, props: PropertyDescriptor): any;
}
export interface IDecoratorBuilder<T> {
(input: T): IDecorator;
}
export interface IDynamicDecorator<T> extends IDecorator, IDecoratorBuilder<T> {
(clazz: object | T, name: string, props: PropertyDescriptor): any | IDecorator;
}
export declare function dynamicDecorator<T>(defaultArg: T, builder: IDecoratorBuilder<T>): IDynamicDecorator<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function dynamicDecorator(defaultArg, builder) {
return function () {
const args = arguments;
if (args.length > 1) {
builder(defaultArg).apply(null, args);
}
else {
return builder(args[0]);
}
};
}
exports.dynamicDecorator = dynamicDecorator;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9saWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFZQSxTQUFnQixnQkFBZ0IsQ0FBSSxVQUFhLEVBQUUsT0FBNkI7SUFDNUUsT0FBTztRQUNILE1BQU0sSUFBSSxHQUFHLFNBQVMsQ0FBQztRQUN2QixJQUFJLElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFO1lBQ2pCLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDO1NBQ3pDO2FBQU07WUFDSCxPQUFPLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztTQUMzQjtJQUNMLENBQUMsQ0FBQTtBQUNMLENBQUM7QUFURCw0Q0FTQyJ9
\ No newline at end of file
export interface IDecorator {
(clazz: object, name: string, props: PropertyDescriptor): any
}
export interface IDecoratorBuilder<T> {
(input: T): IDecorator
}
export interface IDynamicDecorator<T> extends IDecorator, IDecoratorBuilder<T> {
(clazz: object | T, name: string, props: PropertyDescriptor): any | IDecorator;
}
export function dynamicDecorator<T>(defaultArg: T, builder: IDecoratorBuilder<T>): IDynamicDecorator<T> {
return function () {
const args = arguments;
if (args.length > 1) {
builder(defaultArg).apply(null, args);
} else {
return builder(args[0]);
}
}
}
{
"name": "dynamic-decorator",
"version": "1.0.0",
"description": "create dynamic decorator",
"main": "dist/index.js",
"scripts": {
"test": "ts-node test.ts"
},
"keywords": [
"dynamic",
"decorator",
"TypeScript",
"ts"
],
"author": "jerry4718",
"license": "ISC"
}
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"inlineSourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": [
"es2017"
],
"pretty": true,
"declaration": true,
"paths": {}
},
"include": [
"lib/**/*"
]
}
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"no-var-keyword": true,
"semicolon": [
true,
"always",
"ignore-bound-class-methods"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
],
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-null-keyword": true,
"prefer-const": true,
"jsdoc-format": true
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册