From 457c93328f5b51b3fc0aa1600ce8eb8b45a5c2a9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 9 Apr 2022 18:38:29 +0200 Subject: Snowjail v0.1 --- .../yaml/browser/dist/schema/common/seq.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 node_modules/yaml/browser/dist/schema/common/seq.js (limited to 'node_modules/yaml/browser/dist/schema/common/seq.js') diff --git a/node_modules/yaml/browser/dist/schema/common/seq.js b/node_modules/yaml/browser/dist/schema/common/seq.js new file mode 100644 index 0000000..2aa7639 --- /dev/null +++ b/node_modules/yaml/browser/dist/schema/common/seq.js @@ -0,0 +1,33 @@ +import { createNode } from '../../doc/createNode.js'; +import { isSeq } from '../../nodes/Node.js'; +import { YAMLSeq } from '../../nodes/YAMLSeq.js'; + +function createSeq(schema, obj, ctx) { + const { replacer } = ctx; + const seq = new YAMLSeq(schema); + if (obj && Symbol.iterator in Object(obj)) { + let i = 0; + for (let it of obj) { + if (typeof replacer === 'function') { + const key = obj instanceof Set ? it : String(i++); + it = replacer.call(obj, key, it); + } + seq.items.push(createNode(it, undefined, ctx)); + } + } + return seq; +} +const seq = { + collection: 'seq', + createNode: createSeq, + default: true, + nodeClass: YAMLSeq, + tag: 'tag:yaml.org,2002:seq', + resolve(seq, onError) { + if (!isSeq(seq)) + onError('Expected a sequence for this tag'); + return seq; + } +}; + +export { seq }; -- cgit