Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function stringDecoding(string) {
if (string.length === 0) return '';
let currCount = 0;
let i = 0;
let decoding = '';
while (i < string.length) {
const char = string.charAt(i);
if (isNumber(char)) {
const num = Number(char);
currCount = currCount * 10 + num;
} else {
decoding = addCountAmount(decoding, char, currCount);
currCount = 0;
}
i++;
}
return decoding;
}
check: (v) => isNumber(v),
hydrate: (txt) => types.cast(txt, 'numeric')
_processReference(value, stateProvider) {
if (isNumber(value)) {
return value;
} else if (value == null) {
return value;
} else if ('id' in value && isNumber(value.id)) {
return value.id
} else {
throw new Error("Invalid reference: expected id, null or subject")
}
}
values.forEach(v => {
if (isUserAnno && v[0] === globals.unassignedCategoryLabel) {
unassigned.push(v);
} else if (isNumber(v[0])) {
ints.push(v);
} else {
strings.push(v);
}
});
_processReference(value, stateProvider) {
if (isNumber(value)) {
return value;
} else if (value == null) {
return value;
} else if ('id' in value && isNumber(value.id)) {
return value.id
} else {
throw new Error("Invalid reference: expected id, null or subject")
}
}