<commit_before>/**
 * @file:   Platform specific implementation and abstractions
 */

(function(exports) {
    exports.isBrowser = function() {
        return typeof window !== 'undefined';
    };


    /**
     * Construct and return a DOM document from an xml string
     */
    exports.parseXML = function (text) {
        if (exports.isBrowser()) {
            // IE9 (Chakra): http://msdn.microsoft.com/en-us/library/ff975124(v=vs.85).aspx
            // No support for IE < 9 (not falling back to ActiveX Component).
            // FF (Gecko): https://developer.mozilla.org/en/DOM/DOMParser
            // No official documentation for WebKit (Safari, Chromium, Konqueror)
            // and Opera but recent versions of these browsers provide DomParser.
            return (new DOMParser()).parseFromString(text,"text/xml");
        }
        else {
            // Node.js: Use our own implementation around jsdom
            return require('./xmlToDom.js').parseXmlString(text);
        }
    };


    /**
     * Serialize a DOM document into an xml string
     */
    exports.serializeXML = function (doc) {
        if (exports.isBrowser()) {
            // IE9 (Chakra): http://msdn.microsoft.com/en-us/library/ff975124(v=vs.85).aspx
            // No support for IE < 9
            // FF (Gecko): https://developer.mozilla.org/en/XMLSerializer
            // No official documentation for WebKit (Safari, Chromium, Konqueror)
            // and Opera but recent versions of these browsers provide
            // XMLSerializer.
            return (new XMLSerializer()).serializeToString(doc);
        }
        else {
            var domToXml = require('./domToXml.js');
            var XMLSerializer = domToXml.XMLSerializer;
            return (new XMLSerializer()).serializeToString(doc);
        }
    };
<commit_msg>Fix XMLSerializer hiding global instance<commit_after>/**
 * @file:   Platform specific implementation and abstractions
 */

(function(exports) {
    exports.isBrowser = function() {
        return typeof window !== 'undefined';
    };


    /**
     * Construct and return a DOM document from an xml string
     */
    exports.parseXML = function (text) {
        if (exports.isBrowser()) {
            // IE9 (Chakra): http://msdn.microsoft.com/en-us/library/ff975124(v=vs.85).aspx
            // No support for IE < 9 (not falling back to ActiveX Component).
            // FF (Gecko): https://developer.mozilla.org/en/DOM/DOMParser
            // No official documentation for WebKit (Safari, Chromium, Konqueror)
            // and Opera but recent versions of these browsers provide DomParser.
            return (new DOMParser()).parseFromString(text,"text/xml");
        }
        else {
            // Node.js: Use our own implementation around jsdom
            return require('./xmlToDom.js').parseXmlString(text);
        }
    };


    /**
     * Serialize a DOM document into an xml string
     */
    exports.serializeXML = function (doc) {
        if (exports.isBrowser()) {
            // IE9 (Chakra): http://msdn.microsoft.com/en-us/library/ff975124(v=vs.85).aspx
            // No support for IE < 9
            // FF (Gecko): https://developer.mozilla.org/en/XMLSerializer
            // No official documentation for WebKit (Safari, Chromium, Konqueror)
            // and Opera but recent versions of these browsers provide
            // XMLSerializer.
            return (new XMLSerializer()).serializeToString(doc);
        }
        else {
            var domToXml = require('./domToXml.js');
            return (new domToXml.XMLSerializer()).serializeToString(doc);
        }
    };

{'fraction_non_alphanumeric': 0.11971444261394838, 'fraction_numerical': 0.010982976386600769, 'mean_word_length': 2.0232365145228215, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3060431', 'n_tokens_mistral': 1031, 'n_tokens_neox': 956, 'n_words': 265}