@mos-connection/model
Advanced tools
Comparing version
@@ -6,2 +6,28 @@ # Change Log | ||
# [4.2.0-alpha.1](https://github.com/nrkno/sofie-mos-connection/compare/v4.1.1...v4.2.0-alpha.1) (2024-08-27) | ||
# [4.2.0-alpha.0](https://github.com/nrkno/sofie-mos-connection/compare/v4.1.0...v4.2.0-alpha.0) (2024-07-05) | ||
### Bug Fixes | ||
* parse incoming data as strings (Big Refactor) ([0f0f8d3](https://github.com/nrkno/sofie-mos-connection/commit/0f0f8d3986b3fe80153971d271742cc46c0301d1)) | ||
## [4.1.1](https://github.com/nrkno/sofie-mos-connection/compare/v4.1.0...v4.1.1) (2024-08-20) | ||
### Bug Fixes | ||
* update typings for mosTime, undefined was allowed in types, but not in code. ([fb2369a](https://github.com/nrkno/sofie-mos-connection/commit/fb2369abb3a876675c7e941092f96460e2da45f8)) | ||
# [4.1.0](https://github.com/nrkno/sofie-mos-connection/compare/v4.0.0...v4.1.0) (2024-04-02) | ||
@@ -8,0 +34,0 @@ |
@@ -11,3 +11,3 @@ "use strict"; | ||
else if (typeof anyValue === 'string') { | ||
const m = anyValue.match(/(\d+):(\d+):(\d+)/); | ||
const m = /(\d+):(\d+):(\d+)/.exec(anyValue); | ||
if (!m) | ||
@@ -14,0 +14,0 @@ throw new Error(`MosDuration: Invalid input format: "${anyValue}"!`); |
"use strict"; | ||
/* | ||
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 | ||
} | ||
} | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=xmlParse.js.map |
{ | ||
"name": "@mos-connection/model", | ||
"version": "4.2.0-alpha.0", | ||
"version": "4.2.0-alpha.1", | ||
"description": "Types and enums for the mos-connection library", | ||
@@ -44,3 +44,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "682861b1aa78a04e5750646529aae72f6f7f592f" | ||
"gitHead": "a43c2170fef6515207103cd766bd728bb6beffa0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
62641
-1.21%844
-3.21%