Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.join('');
return `#${hexcode}`;
}
if (value instanceof types.List) {
const length = value.getLength();
const list = [];
for (let i = 0; i < length; i++) {
list.push(convert(value.getValue(i)));
}
return list;
}
if (value instanceof types.Map) {
const length = value.getLength();
const map = {};
for (let i = 0; i < length; i++) {
const key = value.getKey(i).getValue();
map[key] = convert(value.getValue(i));
}
return map;
}
if (value instanceof types.Null) {
return null;
}
throw new Error(`Unknown value type: ${value}`);
if (value instanceof types.Number) {
return `${value.getValue()}${value.getUnit()}`;
}
if (value instanceof types.List) {
const length = value.getLength();
const list = [];
for (let i = 0; i < length; i++) {
list.push(convert(value.getValue(i)));
}
return list;
}
if (value instanceof types.Map) {
const length = value.getLength();
const map = {};
for (let i = 0; i < length; i++) {
const key = value.getKey(i).getValue();
map[key] = convert(value.getValue(i));
}
return map;
}
if (value instanceof types.Null) {
return null;
}
throw new Error(`Unknown value type: ${value}`);
if (value instanceof types.Number) {
return `${value.getValue()}${value.getUnit()}`;
}
if (value instanceof types.List) {
const length = value.getLength();
const list = [];
for (let i = 0; i < length; i++) {
list.push(convert(value.getValue(i)));
}
return list;
}
if (value instanceof types.Map) {
const length = value.getLength();
const map = {};
for (let i = 0; i < length; i++) {
const key = value.getKey(i).getValue();
map[key] = convert(value.getValue(i));
}
return map;
}
if (value instanceof types.Null) {
return null;
}
throw new Error(`Unknown value type: ${value}`);