summaryrefslogtreecommitdiff
path: root/index.js
blob: 99fc4f50f5077bf06f1fcea2060f2332f8e89926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

var Yaml = require('./lib/Yaml');

// Compatibility layer with previous version of yaml.js
// That was exposing the YAML library as global object in the browser
if (typeof(window) != 'undefined') {
    window.YAML = {
        parse: function(input, exceptionOnInvalidType, objectDecoder) {
            return Yaml.parse(input, exceptionOnInvalidType, objectDecoder);
        },

        stringify: function(array, inline, indent, exceptionOnInvalidType, objectEncoder) {
            return Yaml.dump(array, inline, indent, exceptionOnInvalidType, objectEncoder);
        }
    };
}

module.exports = {
    Yaml:       require('./lib/Yaml'),
    Parser:     require('./lib/Parser'),
    Dumper:     require('./lib/Dumper')
};