node-opcua-basic-types
Advanced tools
Comparing version 2.16.0 to 2.17.0
@@ -32,3 +32,5 @@ export declare enum AttributeIds { | ||
} | ||
export declare const attributeNameById: any; | ||
export declare const attributeNameById: { | ||
[key: string]: string | number; | ||
}; | ||
export declare function isValidAttributeId(attributeId: any): boolean; |
@@ -8,3 +8,2 @@ "use strict"; | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
const _ = require("underscore"); | ||
var AttributeIds; | ||
@@ -43,6 +42,12 @@ (function (AttributeIds) { | ||
})(AttributeIds = exports.AttributeIds || (exports.AttributeIds = {})); | ||
// deprecated use getAttributeName(attributeId: AttributeIds); | ||
exports.attributeNameById = _.invert(AttributeIds); | ||
// see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore/issues/296 | ||
function invert(a) { | ||
return Object.entries(a).reduce((c, [k, v]) => { | ||
c[v] = k; | ||
return c; | ||
}, {}); | ||
} | ||
exports.attributeNameById = invert(AttributeIds); | ||
function isValidAttributeId(attributeId) { | ||
node_opcua_assert_1.assert(_.isFinite(attributeId)); | ||
node_opcua_assert_1.assert(isFinite(attributeId)); | ||
return attributeId >= 1 && attributeId <= AttributeIds.LAST; | ||
@@ -49,0 +54,0 @@ } |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,1 +1,4 @@ | ||
/*** | ||
* @module node-opcua-basic-types | ||
*/ | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
@@ -2,0 +5,0 @@ export declare function isValidFloat(value: any): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.coerceDouble = exports.coerceFloat = exports.decodeDouble = exports.encodeDouble = exports.randomDouble = exports.isValidDouble = exports.decodeFloat = exports.encodeFloat = exports.randomFloat = exports.isValidFloat = void 0; | ||
/*** | ||
* @module node-opcua-basic-types | ||
*/ | ||
const _ = require("underscore"); | ||
const minFloat = -3.4 * Math.pow(10, 38); | ||
@@ -22,3 +18,3 @@ const maxFloat = 3.4 * Math.pow(10, 38); | ||
function isValidFloat(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -48,3 +44,3 @@ } | ||
function isValidDouble(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -51,0 +47,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeGuid = exports.encodeGuid = exports.randomGuid = void 0; | ||
exports.decodeGuid = exports.encodeGuid = exports.randomGuid = exports.emptyGuid = exports.isValidGuid = void 0; | ||
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream"); | ||
@@ -9,0 +9,0 @@ const node_opcua_guid_1 = require("node-opcua-guid"); |
@@ -13,3 +13,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -16,0 +16,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -8,6 +8,5 @@ "use strict"; | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
const _ = require("underscore"); | ||
const utils_1 = require("./utils"); | ||
function isValidUInt16(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -32,3 +31,3 @@ } | ||
function isValidInt16(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -44,3 +43,3 @@ } | ||
function encodeInt16(value, stream) { | ||
node_opcua_assert_1.assert(_.isFinite(value)); | ||
node_opcua_assert_1.assert(isFinite(value)); | ||
stream.writeInt16(value); | ||
@@ -54,3 +53,3 @@ } | ||
function isValidInt32(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -66,3 +65,3 @@ } | ||
function encodeInt32(value, stream) { | ||
node_opcua_assert_1.assert(_.isFinite(value)); | ||
node_opcua_assert_1.assert(isFinite(value)); | ||
stream.writeInteger(value); | ||
@@ -76,3 +75,3 @@ } | ||
function isValidUInt32(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -96,3 +95,3 @@ } | ||
function isValidInt8(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -121,3 +120,3 @@ } | ||
function isValidUInt8(value) { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -124,0 +123,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeExpandedNodeId = exports.decodeNodeId = exports.encodeExpandedNodeId = exports.encodeNodeId = exports.randomNodeId = exports.isValidNodeId = void 0; | ||
exports.coerceExpandedNodeId = exports.coerceNodeId = exports.decodeExpandedNodeId = exports.decodeNodeId = exports.encodeExpandedNodeId = exports.encodeNodeId = exports.randomNodeId = exports.isValidNodeId = void 0; | ||
/*** | ||
@@ -5,0 +5,0 @@ * @module node-opcua-basic-types |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "node-opcua-basic-types", | ||
"version": "2.16.0", | ||
"version": "2.17.0", | ||
"description": "pure nodejs OPCUA SDK - module -basic-types", | ||
@@ -15,16 +15,14 @@ "main": "./dist/index.js", | ||
"node-opcua-assert": "2.16.0", | ||
"node-opcua-binary-stream": "2.16.0", | ||
"node-opcua-buffer-utils": "2.16.0", | ||
"node-opcua-date-time": "2.16.0", | ||
"node-opcua-enum": "2.16.0", | ||
"node-opcua-binary-stream": "2.17.0", | ||
"node-opcua-buffer-utils": "2.17.0", | ||
"node-opcua-date-time": "2.17.0", | ||
"node-opcua-enum": "2.17.0", | ||
"node-opcua-guid": "2.16.0", | ||
"node-opcua-nodeid": "2.16.0", | ||
"node-opcua-status-code": "2.16.0", | ||
"node-opcua-utils": "2.16.0", | ||
"underscore": "^1.10.2" | ||
"node-opcua-nodeid": "2.17.0", | ||
"node-opcua-status-code": "2.17.0", | ||
"node-opcua-utils": "2.17.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.0.27", | ||
"@types/underscore": "^1.10.20", | ||
"node-opcua-debug": "2.16.0", | ||
"@types/node": "^14.11.1", | ||
"node-opcua-debug": "2.17.0", | ||
"should": "^13.2.3" | ||
@@ -47,3 +45,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "9fa7d50952a7c39ff6790888a2bd6f32fe46836d" | ||
"gitHead": "545072c8184378254468c383b78e74e7e8e31ab7" | ||
} |
@@ -5,3 +5,2 @@ /** | ||
import { assert } from "node-opcua-assert"; | ||
import * as _ from "underscore"; | ||
@@ -41,9 +40,14 @@ export enum AttributeIds { | ||
// deprecated use getAttributeName(attributeId: AttributeIds); | ||
export const attributeNameById = _.invert(AttributeIds); | ||
// see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore/issues/296 | ||
function invert(a: { [key: string]: string | number }) { | ||
return Object.entries(a).reduce((c, [k, v]) => { | ||
c[v] = k; | ||
return c; | ||
}, {} as { [key: string]: string | number }); | ||
} | ||
export const attributeNameById = invert(AttributeIds); | ||
export function isValidAttributeId(attributeId: any) { | ||
assert(_.isFinite(attributeId)); | ||
assert(isFinite(attributeId)); | ||
return attributeId >= 1 && attributeId <= AttributeIds.LAST; | ||
} | ||
/*** | ||
* @module node-opcua-basic-types | ||
*/ | ||
import * as _ from "underscore"; | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
@@ -24,3 +22,3 @@ | ||
export function isValidFloat(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -54,3 +52,3 @@ } | ||
export function isValidDouble(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -57,0 +55,0 @@ } |
@@ -6,7 +6,6 @@ /*** | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import * as _ from "underscore"; | ||
import { getRandomInt } from "./utils"; | ||
export function isValidUInt16(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -45,3 +44,3 @@ } | ||
export function isValidInt16(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -57,3 +56,3 @@ } | ||
export function encodeInt16(value: Int16, stream: OutputBinaryStream): void { | ||
assert(_.isFinite(value)); | ||
assert(isFinite(value)); | ||
stream.writeInt16(value); | ||
@@ -67,3 +66,3 @@ } | ||
export function isValidInt32(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -79,3 +78,3 @@ } | ||
export function encodeInt32(value: Int32, stream: OutputBinaryStream): void { | ||
assert(_.isFinite(value)); | ||
assert(isFinite(value)); | ||
stream.writeInteger(value); | ||
@@ -89,3 +88,3 @@ } | ||
export function isValidUInt32(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -109,3 +108,3 @@ } | ||
export function isValidInt8(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -135,3 +134,3 @@ } | ||
export function isValidUInt8(value: any): boolean { | ||
if (!_.isFinite(value)) { | ||
if (!isFinite(value)) { | ||
return false; | ||
@@ -138,0 +137,0 @@ } |
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
103187
9
3
2018
+ Added@types/lodash@4.14.161(transitive)
+ Addedlodash@4.17.20(transitive)
+ Addednode-opcua-binary-stream@2.17.0(transitive)
+ Addednode-opcua-buffer-utils@2.17.0(transitive)
+ Addednode-opcua-date-time@2.17.0(transitive)
+ Addednode-opcua-enum@2.17.0(transitive)
+ Addednode-opcua-nodeid@2.17.0(transitive)
+ Addednode-opcua-status-code@2.17.0(transitive)
+ Addednode-opcua-utils@2.17.0(transitive)
- Removedunderscore@^1.10.2
- Removednode-opcua-binary-stream@2.16.0(transitive)
- Removednode-opcua-buffer-utils@2.16.0(transitive)
- Removednode-opcua-date-time@2.16.0(transitive)
- Removednode-opcua-enum@2.16.0(transitive)
- Removednode-opcua-nodeid@2.16.0(transitive)
- Removednode-opcua-status-code@2.16.0(transitive)
- Removednode-opcua-utils@2.16.0(transitive)
- Removedunderscore@1.13.7(transitive)
Updatednode-opcua-date-time@2.17.0
Updatednode-opcua-enum@2.17.0
Updatednode-opcua-nodeid@2.17.0
Updatednode-opcua-utils@2.17.0