@sap-ux/yaml
Advanced tools
Comparing version 0.10.3 to 0.11.0
# @sap-ux/yaml | ||
## 0.11.0 | ||
### Minor Changes | ||
- 3783887: Enhance ui5-config module allowing to add the abap-deploy-task and remove any middleware | ||
## 0.10.3 | ||
@@ -4,0 +10,0 @@ |
@@ -118,2 +118,20 @@ import { YAMLMap, YAMLSeq } from 'yaml'; | ||
/** | ||
* Deletes a node in a sequence in the document. | ||
* | ||
* @param path - hierarchical path where the node will be deleted | ||
* @param {string} path.path - the path object's path | ||
* @param {Object} path.matcher - key/value pair identifying the object | ||
* @param {string} path.matcher.key - the key | ||
* @param {string} path.matcher.value - the value | ||
* @returns {YamlDocument} the YamlDocument instance | ||
* @memberof YamlDocument | ||
*/ | ||
deleteAt({ path, matcher }: { | ||
path: string; | ||
matcher: { | ||
key: string; | ||
value: string; | ||
}; | ||
}): YamlDocument; | ||
/** | ||
* @param root0 | ||
@@ -120,0 +138,0 @@ * @param root0.start |
@@ -209,2 +209,33 @@ "use strict"; | ||
/** | ||
* Deletes a node in a sequence in the document. | ||
* | ||
* @param path - hierarchical path where the node will be deleted | ||
* @param {string} path.path - the path object's path | ||
* @param {Object} path.matcher - key/value pair identifying the object | ||
* @param {string} path.matcher.key - the key | ||
* @param {string} path.matcher.value - the value | ||
* @returns {YamlDocument} the YamlDocument instance | ||
* @memberof YamlDocument | ||
*/ | ||
deleteAt({ path, matcher }) { | ||
const pathArray = this.toPathArray(path); | ||
const seq = this.document.getIn(pathArray); | ||
if (!seq || !seq.items) { | ||
throw new Error((0, i18n_1.t)('error.seqDoesNotExist', { path })); | ||
} | ||
const deletedNode = seq.items.find((node, index) => { | ||
if (node.toJSON()[matcher.key] === matcher.value) { | ||
seq.items.splice(index, 1); | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
}); | ||
if (!deletedNode) { | ||
throw new Error((0, i18n_1.t)('error.propertyNotFound', { path })); | ||
} | ||
return this; | ||
} | ||
/** | ||
* @param root0 | ||
@@ -211,0 +242,0 @@ * @param root0.start |
{ | ||
"name": "@sap-ux/yaml", | ||
"description": "Library to manipulate YAML file contents", | ||
"version": "0.10.3", | ||
"version": "0.11.0", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
44963
568