wikibase-edit
Version:
Edit Wikibase from NodeJS
20 lines • 663 B
JavaScript
import { newError } from '../error.js';
import { validateEntityId, validateLanguage } from '../validate.js';
export function setLabelOrDescriptionFactory(name) {
return function setLabelOrDescription(params) {
const { id, language } = params;
let { value } = params;
const action = `wbset${name}`;
validateEntityId(id);
validateLanguage(language);
if (value === undefined)
throw newError(`missing ${name}`, params);
if (value === null)
value = '';
return {
action,
data: { id, language, value },
};
};
}
//# sourceMappingURL=set.js.map