mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-12-09 22:30:41 -07:00
node_modules: upgrade
This commit is contained in:
36
node_modules/yaml/browser/dist/nodes/YAMLMap.js
generated
vendored
36
node_modules/yaml/browser/dist/nodes/YAMLMap.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
import { stringifyCollection } from '../stringify/stringifyCollection.js';
|
||||
import { addPairToJSMap } from './addPairToJSMap.js';
|
||||
import { Collection } from './Collection.js';
|
||||
import { isPair, isScalar, MAP } from './Node.js';
|
||||
import { Pair } from './Pair.js';
|
||||
import { isPair, isScalar, MAP } from './identity.js';
|
||||
import { Pair, createPair } from './Pair.js';
|
||||
import { isScalarValue } from './Scalar.js';
|
||||
|
||||
function findPair(items, key) {
|
||||
@@ -18,12 +18,40 @@ function findPair(items, key) {
|
||||
return undefined;
|
||||
}
|
||||
class YAMLMap extends Collection {
|
||||
static get tagName() {
|
||||
return 'tag:yaml.org,2002:map';
|
||||
}
|
||||
constructor(schema) {
|
||||
super(MAP, schema);
|
||||
this.items = [];
|
||||
}
|
||||
static get tagName() {
|
||||
return 'tag:yaml.org,2002:map';
|
||||
/**
|
||||
* A generic collection parsing method that can be extended
|
||||
* to other node classes that inherit from YAMLMap
|
||||
*/
|
||||
static from(schema, obj, ctx) {
|
||||
const { keepUndefined, replacer } = ctx;
|
||||
const map = new this(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(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;
|
||||
}
|
||||
/**
|
||||
* Adds a value to the collection.
|
||||
|
||||
Reference in New Issue
Block a user