node-opcua-xml2json
Advanced tools
Comparing version 2.49.0 to 2.51.0
@@ -23,3 +23,3 @@ "use strict"; | ||
init(name, attrs) { | ||
node_opcua_assert_1.default(!this.parent.definitionFields || this.parent.definitionFields.length === 0); | ||
(0, node_opcua_assert_1.default)(!this.parent.definitionFields || this.parent.definitionFields.length === 0); | ||
this.parent.definitionFields = []; | ||
@@ -26,0 +26,0 @@ this.parent.definitionName = attrs.SymbolicName || attrs.Name; |
@@ -184,3 +184,3 @@ "use strict"; | ||
finish() { | ||
const elName = node_opcua_utils_1.lowerFirstLetter(field.name); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(field.name); | ||
fieldReader.finish.call(this); | ||
@@ -199,3 +199,3 @@ this.parent.value = this.parent.value || {}; | ||
finish() { | ||
const elName = node_opcua_utils_1.lowerFirstLetter(this.name); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(this.name); | ||
this.parent.value = this.parent.value || {}; | ||
@@ -202,0 +202,0 @@ this.parent.value[elName] = this.value; |
@@ -35,3 +35,3 @@ "use strict"; | ||
elementName = elementName.substring(6); | ||
const elName = node_opcua_utils_1.lowerFirstLetter(elementName); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(elementName); | ||
if (this._element instanceof Array) { | ||
@@ -48,3 +48,3 @@ const array = []; | ||
else { | ||
const elName = node_opcua_utils_1.lowerFirstLetter(elementName); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(elementName); | ||
if (this._element instanceof Array) { | ||
@@ -67,3 +67,3 @@ const obj = {}; | ||
if (this.text.length > 0 && this._element) { | ||
const elName = node_opcua_utils_1.lowerFirstLetter(elementName); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(elementName); | ||
this._element[elName] = this.text; | ||
@@ -73,3 +73,3 @@ // this.engine!._pojo = this._pojo; | ||
else { | ||
const elName = node_opcua_utils_1.lowerFirstLetter(elementName); | ||
const elName = (0, node_opcua_utils_1.lowerFirstLetter)(elementName); | ||
if (this.initLevel === level) { | ||
@@ -76,0 +76,0 @@ if (this._withPojo) { |
@@ -70,3 +70,3 @@ /** | ||
text: string; | ||
name?: string; | ||
name?: string | undefined; | ||
level: number; | ||
@@ -73,0 +73,0 @@ currentLevel: number; |
@@ -79,3 +79,3 @@ "use strict"; | ||
this.attrs = attrs; | ||
node_opcua_assert_1.assert(this.attrs); | ||
(0, node_opcua_assert_1.assert)(this.attrs); | ||
if (this._init) { | ||
@@ -104,3 +104,3 @@ this._init(elementName, attrs, parent, engine); | ||
} | ||
if (this.engine && this.parser.hasOwnProperty(elementName)) { | ||
if (this.engine && Object.prototype.hasOwnProperty.call(this.parser, elementName)) { | ||
// console.log("promoting ", elementName, this.level); | ||
@@ -121,3 +121,3 @@ this.engine._promote(this.parser[elementName], level, elementName, attrs); | ||
// console.log("wxxxx _on_endElement#" + this.name, elementName, level, this.currentLevel); | ||
node_opcua_assert_1.assert(this.attrs); | ||
(0, node_opcua_assert_1.assert)(this.attrs); | ||
this.chunks = this.chunks || []; | ||
@@ -135,3 +135,5 @@ if (this.level > level) { | ||
this._on_finish(); | ||
if (this.parent && this.parent.parser && this.parent.parser.hasOwnProperty(elementName)) { | ||
if (this.parent && | ||
this.parent.parser && | ||
Object.prototype.hasOwnProperty.call(this.parent.parser, elementName)) { | ||
// console.log("xxx demoting#" + this.name, elementName, this.level); | ||
@@ -256,3 +258,3 @@ this.engine._demote(this, level, elementName); | ||
_prepareParser(callback) { | ||
node_opcua_assert_1.assert(callback instanceof Function); | ||
(0, node_opcua_assert_1.assert)(callback instanceof Function); | ||
const parser = new LtxParser(); | ||
@@ -259,0 +261,0 @@ this.currentLevel = 0; |
{ | ||
"name": "node-opcua-xml2json", | ||
"version": "2.49.0", | ||
"version": "2.51.0", | ||
"description": "pure nodejs OPCUA SDK - module -xml2json", | ||
@@ -14,6 +14,6 @@ "main": "dist/source/index.js", | ||
"bomstrip": "^0.1.4", | ||
"ltx": "^2.10.0", | ||
"node-opcua-assert": "2.42.0", | ||
"node-opcua-debug": "2.42.0", | ||
"node-opcua-utils": "2.44.0", | ||
"ltx": "^3.0.0", | ||
"node-opcua-assert": "2.51.0", | ||
"node-opcua-debug": "2.51.0", | ||
"node-opcua-utils": "2.51.0", | ||
"xml-writer": "^1.7.0" | ||
@@ -24,3 +24,3 @@ }, | ||
"devDependencies": { | ||
"node-opcua-nodesets": "2.41.1", | ||
"node-opcua-nodesets": "2.51.0", | ||
"should": "^13.2.3" | ||
@@ -41,3 +41,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "81654553c6d317fd918ca99b749550eb5e951c23" | ||
"gitHead": "75feb111daf7ec65fa0111e4fa5beb8987fd4945" | ||
} |
@@ -112,6 +112,6 @@ /** | ||
public chunks: any[] = []; | ||
public text: string = ""; | ||
public name?: string = ""; | ||
public level: number = -1; | ||
public currentLevel: number = -1; | ||
public text = ""; | ||
public name? = ""; | ||
public level = -1; | ||
public currentLevel = -1; | ||
@@ -148,3 +148,3 @@ public engine?: Xml2Json; | ||
*/ | ||
public _on_init(elementName: string, attrs: XmlAttributes, parent: IReaderState, level: number, engine: Xml2Json) { | ||
public _on_init(elementName: string, attrs: XmlAttributes, parent: IReaderState, level: number, engine: Xml2Json): void { | ||
this.name = elementName; | ||
@@ -163,3 +163,3 @@ this.parent = parent; | ||
public _on_finish() { | ||
public _on_finish(): void { | ||
if (this._finish) { | ||
@@ -176,3 +176,3 @@ this._finish(); | ||
*/ | ||
public _on_startElement(level: number, elementName: string, attrs: XmlAttributes) { | ||
public _on_startElement(level: number, elementName: string, attrs: XmlAttributes): void { | ||
this.currentLevel = level; | ||
@@ -187,3 +187,3 @@ // console.log("wxxxx _on_startElement#" + this.name, elementName, this.currentLevel); | ||
} | ||
if (this.engine && this.parser.hasOwnProperty(elementName)) { | ||
if (this.engine && Object.prototype.hasOwnProperty.call(this.parser, elementName)) { | ||
// console.log("promoting ", elementName, this.level); | ||
@@ -219,3 +219,7 @@ this.engine._promote(this.parser[elementName], level, elementName, attrs); | ||
this._on_finish(); | ||
if (this.parent && (this.parent as any).parser && (this.parent as any).parser.hasOwnProperty(elementName)) { | ||
if ( | ||
this.parent && | ||
(this.parent as any).parser && | ||
Object.prototype.hasOwnProperty.call((this.parent as any).parser, elementName) | ||
) { | ||
// console.log("xxx demoting#" + this.name, elementName, this.level); | ||
@@ -297,3 +301,3 @@ this.engine!._demote(this, level, elementName); | ||
export class Xml2Json { | ||
public currentLevel: number = 0; | ||
public currentLevel = 0; | ||
private state_stack: any[] = []; | ||
@@ -329,3 +333,3 @@ private current_state: IReaderState | null = null; | ||
*/ | ||
public _promote(new_state: IReaderState, level: number, name?: string, attr?: XmlAttributes) { | ||
public _promote(new_state: IReaderState, level: number, name?: string, attr?: XmlAttributes): void { | ||
attr = attr || {}; | ||
@@ -347,3 +351,3 @@ this.state_stack.push({ | ||
*/ | ||
public _demote(cur_state: IReaderState, level: number, elementName: string) { | ||
public _demote(cur_state: IReaderState, level: number, elementName: string): void { | ||
/// assert(this.current_state === cur_state); | ||
@@ -350,0 +354,0 @@ const { state, backup } = this.state_stack.pop(); |
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
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
95518
1982
+ Addedchalk@4.1.2(transitive)
+ Addedltx@3.0.0(transitive)
+ Addednode-opcua-assert@2.51.0(transitive)
+ Addednode-opcua-buffer-utils@2.51.0(transitive)
+ Addednode-opcua-debug@2.51.0(transitive)
+ Addednode-opcua-utils@2.51.0(transitive)
- Removedchalk@4.1.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedltx@2.10.0(transitive)
- Removednode-opcua-assert@2.42.0(transitive)
- Removednode-opcua-buffer-utils@2.42.0(transitive)
- Removednode-opcua-debug@2.42.0(transitive)
- Removednode-opcua-utils@2.44.0(transitive)
Updatedltx@^3.0.0
Updatednode-opcua-assert@2.51.0
Updatednode-opcua-debug@2.51.0
Updatednode-opcua-utils@2.51.0