@documentica/webdav
Version:
Documentica Webdav Client
26 lines (25 loc) • 687 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
function fromXML(nodelist) {
var node = nodelist.item(0);
if ((node.nodeType === 3) || (node.nodeType === 4)) { // Make sure text and CDATA content is stored
return new Date(node.nodeValue);
}
else { // If the node is not text or CDATA, then we don't parse a value at all
return null;
}
}
exports.fromXML = fromXML;
;
function toXML(value, xmlDoc) {
var cdata = xmlDoc.createCDATASection(value.toISOString());
xmlDoc.documentElement.appendChild(cdata);
return xmlDoc;
}
exports.toXML = toXML;
;
const codec = {
fromXML,
toXML
};
exports.default = codec;
;