Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-opcua-nodeid

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-nodeid - npm Package Compare versions

Comparing version 2.52.0 to 2.53.0

20

dist/nodeid.js

@@ -43,2 +43,15 @@ "use strict";

})(NodeIdType = exports.NodeIdType || (exports.NodeIdType = {}));
/*function defaultValue(identifierType: NodeIdType.BYTESTRING): null;
function defaultValue(identifierType: NodeIdType.STRING): null;
function defaultValue(identifierType: NodeIdType.NUMERIC): 0;
function defaultValue(identifierType: NodeIdType.GUID): null;
*/
function defaultValue(identifierType) {
switch (identifierType) {
case NodeIdType.GUID: return node_opcua_guid_1.emptyGuid;
case NodeIdType.BYTESTRING: return null; // Buffer.alloc(0);
case NodeIdType.STRING: return "";
case NodeIdType.NUMERIC: return 0;
}
}
/**

@@ -69,10 +82,11 @@ * Construct a node ID

this.identifierType = identifierType;
this.value = value || 0;
this.value = value || defaultValue(identifierType);
this.namespace = namespace || 0;
// namespace shall be a UInt16
(0, node_opcua_assert_1.assert)(this.namespace >= 0 && this.namespace <= 0xffff);
(0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.NUMERIC || (this.value >= 0 && this.value <= 0xffffffff));
(0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.NUMERIC || (this.value !== null && this.value >= 0 && this.value <= 0xffffffff));
(0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.GUID || (0, node_opcua_guid_1.isValidGuid)(this.value));
(0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");
}
;
/**

@@ -122,3 +136,3 @@ * get the string representation of the nodeID.

// find standard browse name
const name = reverse_map(this.value.toString()) || "<undefined>";
const name = reverse_map((this.value || 0).toString()) || "<undefined>";
str += " " + chalk.green.bold(name);

@@ -125,0 +139,0 @@ }

4

package.json

@@ -5,3 +5,3 @@ {

"types": "./dist/index.d.ts",
"version": "2.52.0",
"version": "2.53.0",
"description": "pure nodejs OPCUA SDK - module -nodeid",

@@ -44,3 +44,3 @@ "scripts": {

"homepage": "http://node-opcua.github.io/",
"gitHead": "3ec6296e8fd4df0e05b9d887f0b7dd20113a9ce1"
"gitHead": "f7da55bc8e581496b85970a6cee1a1e707f76c29"
}

@@ -48,3 +48,15 @@ /**

}
/*function defaultValue(identifierType: NodeIdType.BYTESTRING): null;
function defaultValue(identifierType: NodeIdType.STRING): null;
function defaultValue(identifierType: NodeIdType.NUMERIC): 0;
function defaultValue(identifierType: NodeIdType.GUID): null;
*/
function defaultValue(identifierType: NodeIdType): string | number| Buffer {
switch(identifierType) {
case NodeIdType.GUID : return emptyGuid;
case NodeIdType.BYTESTRING : return null as any as Buffer;// Buffer.alloc(0);
case NodeIdType.STRING : return "";
case NodeIdType.NUMERIC : return 0;
}
}
/**

@@ -68,3 +80,3 @@ * Construct a node ID

public identifierType: NodeIdType;
public value: number | string | Buffer | Guid;
public value: number | string | Buffer | Guid;;
public namespace: number;

@@ -84,4 +96,5 @@

}
this.identifierType = identifierType;
this.value = value || 0;
this.value = value || defaultValue(identifierType);
this.namespace = namespace || 0;

@@ -92,3 +105,3 @@

assert(this.identifierType !== NodeIdType.NUMERIC || (this.value >= 0 && this.value <= 0xffffffff));
assert(this.identifierType !== NodeIdType.NUMERIC || (this.value !== null && this.value >= 0 && this.value <= 0xffffffff));
assert(this.identifierType !== NodeIdType.GUID || isValidGuid(this.value as string));

@@ -142,3 +155,3 @@ assert(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");

// find standard browse name
const name = reverse_map(this.value.toString()) || "<undefined>";
const name = reverse_map((this.value||0).toString()) || "<undefined>";
str += " " + chalk.green.bold(name);

@@ -145,0 +158,0 @@ } else if (addressSpace.findNode) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc