node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2024-01-17 10:08:10 +01:00
parent 9ff0bc8d99
commit 00765f79cf
320 changed files with 31840 additions and 1039 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
var createNode = require('../doc/createNode.js');
var identity = require('./identity.js');
var Node = require('./Node.js');
function collectionFromPath(schema, path, value) {
@@ -49,7 +50,7 @@ class Collection extends Node.NodeBase {
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
if (schema)
copy.schema = schema;
copy.items = copy.items.map(it => Node.isNode(it) || Node.isPair(it) ? it.clone(schema) : it);
copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);
if (this.range)
copy.range = this.range.slice();
return copy;
@@ -65,7 +66,7 @@ class Collection extends Node.NodeBase {
else {
const [key, ...rest] = path;
const node = this.get(key, true);
if (Node.isCollection(node))
if (identity.isCollection(node))
node.addIn(rest, value);
else if (node === undefined && this.schema)
this.set(key, collectionFromPath(this.schema, rest, value));
@@ -82,7 +83,7 @@ class Collection extends Node.NodeBase {
if (rest.length === 0)
return this.delete(key);
const node = this.get(key, true);
if (Node.isCollection(node))
if (identity.isCollection(node))
return node.deleteIn(rest);
else
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
@@ -96,18 +97,18 @@ class Collection extends Node.NodeBase {
const [key, ...rest] = path;
const node = this.get(key, true);
if (rest.length === 0)
return !keepScalar && Node.isScalar(node) ? node.value : node;
return !keepScalar && identity.isScalar(node) ? node.value : node;
else
return Node.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
}
hasAllNullValues(allowScalar) {
return this.items.every(node => {
if (!Node.isPair(node))
if (!identity.isPair(node))
return false;
const n = node.value;
return (n == null ||
(allowScalar &&
Node.isScalar(n) &&
identity.isScalar(n) &&
n.value == null &&
!n.commentBefore &&
!n.comment &&
@@ -122,7 +123,7 @@ class Collection extends Node.NodeBase {
if (rest.length === 0)
return this.has(key);
const node = this.get(key, true);
return Node.isCollection(node) ? node.hasIn(rest) : false;
return identity.isCollection(node) ? node.hasIn(rest) : false;
}
/**
* Sets a value in this collection. For `!!set`, `value` needs to be a
@@ -135,7 +136,7 @@ class Collection extends Node.NodeBase {
}
else {
const node = this.get(key, true);
if (Node.isCollection(node))
if (identity.isCollection(node))
node.setIn(rest, value);
else if (node === undefined && this.schema)
this.set(key, collectionFromPath(this.schema, rest, value));