map.js 439 B

1234567891011121314151617
  1. import { isMap } from '../../nodes/identity.js';
  2. import { YAMLMap } from '../../nodes/YAMLMap.js';
  3. const map = {
  4. collection: 'map',
  5. default: true,
  6. nodeClass: YAMLMap,
  7. tag: 'tag:yaml.org,2002:map',
  8. resolve(map, onError) {
  9. if (!isMap(map))
  10. onError('Expected a mapping for this tag');
  11. return map;
  12. },
  13. createNode: (schema, obj, ctx) => YAMLMap.from(schema, obj, ctx)
  14. };
  15. export { map };