UNPKG

1.79 kBJavaScriptView Raw
1'use strict';
2
3
4var loader = require('./lib/loader');
5var dumper = require('./lib/dumper');
6
7
8function renamed(from, to) {
9 return function () {
10 throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
11 'Use yaml.' + to + ' instead, which is now safe by default.');
12 };
13}
14
15
16module.exports.Type = require('./lib/type');
17module.exports.Schema = require('./lib/schema');
18module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe');
19module.exports.JSON_SCHEMA = require('./lib/schema/json');
20module.exports.CORE_SCHEMA = require('./lib/schema/core');
21module.exports.DEFAULT_SCHEMA = require('./lib/schema/default');
22module.exports.load = loader.load;
23module.exports.loadAll = loader.loadAll;
24module.exports.dump = dumper.dump;
25module.exports.YAMLException = require('./lib/exception');
26
27// Re-export all types in case user wants to create custom schema
28module.exports.types = {
29 binary: require('./lib/type/binary'),
30 float: require('./lib/type/float'),
31 map: require('./lib/type/map'),
32 null: require('./lib/type/null'),
33 pairs: require('./lib/type/pairs'),
34 set: require('./lib/type/set'),
35 timestamp: require('./lib/type/timestamp'),
36 bool: require('./lib/type/bool'),
37 int: require('./lib/type/int'),
38 merge: require('./lib/type/merge'),
39 omap: require('./lib/type/omap'),
40 seq: require('./lib/type/seq'),
41 str: require('./lib/type/str')
42};
43
44// Removed functions from JS-YAML 3.0.x
45module.exports.safeLoad = renamed('safeLoad', 'load');
46module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll');
47module.exports.safeDump = renamed('safeDump', 'dump');