wikibase-edit
Version:
Edit Wikibase from NodeJS
13 lines • 502 B
JavaScript
import { parseQuantity } from './quantity.js';
import { hasSpecialSnaktype } from './special_snaktype.js';
export function formatClaimValue(datatype, value, instance) {
if (hasSpecialSnaktype(value))
return value;
// Try to recover data passed in a different type than the one expected:
// - Quantities should be of type number
if (datatype === 'quantity') {
return parseQuantity(value, instance);
}
return value;
}
//# sourceMappingURL=format_claim_value.js.map