@sap-ux/yaml
Advanced tools
Comparing version 0.12.4 to 0.13.0
@@ -107,6 +107,7 @@ import type { YAMLMap } from 'yaml'; | ||
* @param path.matcher.value - value of the key | ||
* @param {'merge' | 'overwrite'} [path.mode] - optional update mode: merge or overwrite, default is merge | ||
* @returns {YamlDocument} the YamlDocument instance | ||
* @memberof YamlDocument | ||
*/ | ||
updateAt<T = unknown>({ path, matcher, value }: { | ||
updateAt<T = unknown>({ path, matcher, value, mode }: { | ||
path: string; | ||
@@ -118,2 +119,3 @@ matcher: { | ||
value: T; | ||
mode?: 'merge' | 'overwrite'; | ||
}): YamlDocument; | ||
@@ -120,0 +122,0 @@ /** |
@@ -201,6 +201,7 @@ "use strict"; | ||
* @param path.matcher.value - value of the key | ||
* @param {'merge' | 'overwrite'} [path.mode] - optional update mode: merge or overwrite, default is merge | ||
* @returns {YamlDocument} the YamlDocument instance | ||
* @memberof YamlDocument | ||
*/ | ||
updateAt({ path, matcher, value }) { | ||
updateAt({ path, matcher, value, mode = 'merge' }) { | ||
const pathArray = this.toPathArray(path); | ||
@@ -215,3 +216,4 @@ const seq = this.document.getIn(pathArray); | ||
} | ||
const newNode = this.document.createNode(merge_1.default(node.toJSON(), value)); | ||
const newValue = mode === 'merge' ? merge_1.default(node.toJSON(), value) : value; | ||
const newNode = this.document.createNode(newValue); | ||
seq.items.splice(seq.items.indexOf(node), 1, newNode); | ||
@@ -218,0 +220,0 @@ return this; |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "0.12.4", | ||
"version": "0.13.0", | ||
"main": "dist/index.js", | ||
@@ -15,0 +15,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39798
651