function createRestriction(def) {
    if (typeof def === "string") {
        return new Restriction({ name: def })
    }
    return new Restriction(def)
}
Create a restriction.
@param {string | DefinitionData} def A definition.
@returns {Restriction} Created restriction.