@wocker/core
Version:
Core of the Wocker
23 lines (22 loc) • 713 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Option = void 0;
require("reflect-metadata");
const env_1 = require("../env");
const Option = (name, aliasOrParams) => {
return (target, key, index) => {
if (!key) {
return;
}
Reflect.defineMetadata(env_1.ARGS_METADATA, [
{
type: "option",
name,
params: typeof aliasOrParams === "string" ? { alias: aliasOrParams } : aliasOrParams,
index
},
...Reflect.getMetadata(env_1.ARGS_METADATA, target.constructor, key) || []
], target.constructor, key);
};
};
exports.Option = Option;