Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public changeType(type: string): void {
let nt: SimplifiedType = new SimplifiedType();
if (type === "enum") {
nt.type = "string";
nt.enum_ = [];
nt.of = null;
nt.as = null;
} else {
nt.type = type;
nt.enum_ = null;
nt.of = null;
nt.as = null;
}
this.onChange.emit(nt);
}
public changeTypeAs(typeAs: string): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = this.value.type;
nt.enum_ = null;
if (nt.isSimpleType()) {
nt.of = null;
nt.as = typeAs;
}
if (nt.isArray()) {
nt.of = new SimplifiedType();
nt.of.as = typeAs;
if (this.value.of) {
nt.of.type = this.value.of.type;
}
}
this.onChange.emit(nt);
}
public changeTypeOf(typeOf: string): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = this.value.type;
nt.of = new SimplifiedType();
nt.of.type = typeOf;
nt.as = null;
this.onChange.emit(nt);
}
public changeType(newType: SimplifiedType): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = newType.type;
nt.enum_ = newType.enum_;
nt.of = newType.of;
nt.as = newType.as;
let command: ICommand = CommandFactory.createChangeMediaTypeTypeCommand(this.item, nt);
this.commandService.emit(command);
this._model = nt;
}
public changeTypeAs(typeAs: string): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = this.value.type;
nt.enum_ = null;
if (nt.isSimpleType()) {
nt.of = null;
nt.as = typeAs;
}
if (nt.isArray()) {
nt.of = new SimplifiedType();
nt.of.as = typeAs;
if (this.value.of) {
nt.of.type = this.value.of.type;
}
}
this.onChange.emit(nt);
}
public changeTypeOf(typeOf: string): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = this.value.type;
nt.of = new SimplifiedType();
nt.of.type = typeOf;
nt.as = null;
this.onChange.emit(nt);
}
public changeTypeEnum(value: string[]): void {
let nt: SimplifiedType = new SimplifiedType();
nt.type = this.value.type;
if (!nt.type) {
nt.type = "string";
}
nt.enum_ = value;
nt.of = null;
nt.as = null;
this.onChange.emit(nt);
}