Skip to content

Commit

Permalink
chore: commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Aug 27, 2024
1 parent 3ba15fd commit b29c480
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
11 changes: 0 additions & 11 deletions packages/helper/src/mosModel/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,3 @@ function flattenXMLTextInner(strings: string[], xml: AnyXMLValue, strict: boolea
// else
if (strict) throw new Error(`flattenXMLText, unhandled value: ${JSON.stringify(xml)}`)
}

// type XMLElement =
// | {
// $name: string
// $type: 'element'
// elements?: XMLElement[]
// }
// | {
// $type: 'text'
// text: string
// }
42 changes: 0 additions & 42 deletions packages/model/src/xmlParse.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
/*
Note: There are a few helper functions that are useful when working with the XML data.
function doSomething(value: AnyXMLValue) {
if (MosModel.isXMLObject(value)) {
// Now we know that value is an object
console.log(value.property)
} else if (MosModel.isSingular(value)) {
// Now we know that value is a singular value (ie string or undefined)
console.log(value)
} else if (MosModel.isSingularArray(value)) {
// Now we know that value is an array of singular values (ie string or undefined)
console.log(value.join(', '))
}
// If there can be one or more xml tags of a type, it is useful to traverse them like this:
for (const valueEntry of MosModel.ensureArray(value)) {
console.log(valueEntry)
}
// If you KNOW that a value is supposed to be an object, you can use this:
value = MosModel.ensureXMLObject(value, strict)
// If strict is true, it will throw an error if the value is not an object
// If strict is false, it will return an empty object if the value is not an object
// If you KNOW that a value is supposed to be a singular value (ie a string), you can use this:
value = MosModel.ensureSingular(value, strict)
// If strict is true, it will throw an error if the value is not a singular value
// If strict is false, it will return undefined if the value is not singular
}
}
*/

/** Parsed xml data objects */
export type AnyXMLObject = { [key: string]: AnyXMLValue }
/** Parsed xml data values */
Expand Down

0 comments on commit b29c480

Please sign in to comment.