summaryrefslogtreecommitdiff
path: root/src/node_modules/inversify/es/annotation/optional.js
blob: e99a21d64e7fcf034a2aa7a1acab4114daeb9e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import * as METADATA_KEY from "../constants/metadata_keys";
import { Metadata } from "../planning/metadata";
import { tagParameter, tagProperty } from "./decorator_utils";
function optional() {
    return function (target, targetKey, index) {
        var metadata = new Metadata(METADATA_KEY.OPTIONAL_TAG, true);
        if (typeof index === "number") {
            tagParameter(target, targetKey, index, metadata);
        }
        else {
            tagProperty(target, targetKey, metadata);
        }
    };
}
export { optional };