aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/schema/common/map.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/yaml/dist/schema/common/map.js')
-rw-r--r--node_modules/yaml/dist/schema/common/map.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/node_modules/yaml/dist/schema/common/map.js b/node_modules/yaml/dist/schema/common/map.js
deleted file mode 100644
index 46dab3c..0000000
--- a/node_modules/yaml/dist/schema/common/map.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict';
-
-var Node = require('../../nodes/Node.js');
-var Pair = require('../../nodes/Pair.js');
-var YAMLMap = require('../../nodes/YAMLMap.js');
-
-function createMap(schema, obj, ctx) {
- const { keepUndefined, replacer } = ctx;
- const map = new YAMLMap.YAMLMap(schema);
- const add = (key, value) => {
- if (typeof replacer === 'function')
- value = replacer.call(obj, key, value);
- else if (Array.isArray(replacer) && !replacer.includes(key))
- return;
- if (value !== undefined || keepUndefined)
- map.items.push(Pair.createPair(key, value, ctx));
- };
- if (obj instanceof Map) {
- for (const [key, value] of obj)
- add(key, value);
- }
- else if (obj && typeof obj === 'object') {
- for (const key of Object.keys(obj))
- add(key, obj[key]);
- }
- if (typeof schema.sortMapEntries === 'function') {
- map.items.sort(schema.sortMapEntries);
- }
- return map;
-}
-const map = {
- collection: 'map',
- createNode: createMap,
- default: true,
- nodeClass: YAMLMap.YAMLMap,
- tag: 'tag:yaml.org,2002:map',
- resolve(map, onError) {
- if (!Node.isMap(map))
- onError('Expected a mapping for this tag');
- return map;
- }
-};
-
-exports.map = map;