class Alias extends String {
toJson() {
try {
let value = this.concat()
if (value) {
value = JSON.parse(value);
}
return value;
} catch (error) {
throw new Error(`It isn't JSON string.`)
};
}
}
export class Aliases {
constructor(aliases) {
if (!aliases) throw new Error('Array of aliases are required in params.')
aliases.forEach(alias => {
this[alias.code] = new Alias(alias.value);
})
}
}