node-opcua-numeric-range
Advanced tools
Comparing version 2.85.0 to 2.86.0
@@ -21,3 +21,3 @@ /// <reference types="node" /> | ||
} | ||
declare type NumericalRangeValueType = null | number | string | number[] | number[][]; | ||
type NumericalRangeValueType = null | number | string | number[] | number[][]; | ||
export interface NumericalRangeSingleValue { | ||
@@ -43,3 +43,3 @@ type: NumericRangeType.SingleValue; | ||
} | ||
export declare type NumericalRange0 = NumericalRangeSingleValue | NumericalRangeArrayRange | NumericalRangeMatrixRange | NumericalRangeEmpty | NumericalRangeInvalid; | ||
export type NumericalRange0 = NumericalRangeSingleValue | NumericalRangeArrayRange | NumericalRangeMatrixRange | NumericalRangeEmpty | NumericalRangeInvalid; | ||
export interface NumericalRange1 { | ||
@@ -46,0 +46,0 @@ type: NumericRangeType; |
@@ -225,2 +225,25 @@ "use strict"; | ||
class NumericRange { | ||
static overlap(nr1, nr2) { | ||
nr1 = nr1 || NumericRange.empty; | ||
nr2 = nr2 || NumericRange.empty; | ||
if (NumericRangeType.Empty === nr1.type || NumericRangeType.Empty === nr2.type) { | ||
return true; | ||
} | ||
if (NumericRangeType.SingleValue === nr1.type && NumericRangeType.SingleValue === nr2.type) { | ||
return nr1.value === nr2.value; | ||
} | ||
if (NumericRangeType.ArrayRange === nr1.type && NumericRangeType.ArrayRange === nr2.type) { | ||
// +-----+ +------+ +---+ +------+ | ||
// +----+ +---+ +--------+ +---+ | ||
const l1 = nr1.value[0]; | ||
const h1 = nr1.value[1]; | ||
const l2 = nr2.value[0]; | ||
const h2 = nr2.value[1]; | ||
return _overlap(l1, h1, l2, h2); | ||
} | ||
// istanbul ignore next | ||
(0, node_opcua_assert_1.assert)(false, "NumericalRange#overlap : case not implemented yet "); // TODO | ||
// istanbul ignore next | ||
return false; | ||
} | ||
constructor(value, secondValue) { | ||
@@ -254,25 +277,2 @@ this.type = NumericRangeType.InvalidRange; | ||
} | ||
static overlap(nr1, nr2) { | ||
nr1 = nr1 || NumericRange.empty; | ||
nr2 = nr2 || NumericRange.empty; | ||
if (NumericRangeType.Empty === nr1.type || NumericRangeType.Empty === nr2.type) { | ||
return true; | ||
} | ||
if (NumericRangeType.SingleValue === nr1.type && NumericRangeType.SingleValue === nr2.type) { | ||
return nr1.value === nr2.value; | ||
} | ||
if (NumericRangeType.ArrayRange === nr1.type && NumericRangeType.ArrayRange === nr2.type) { | ||
// +-----+ +------+ +---+ +------+ | ||
// +----+ +---+ +--------+ +---+ | ||
const l1 = nr1.value[0]; | ||
const h1 = nr1.value[1]; | ||
const l2 = nr2.value[0]; | ||
const h2 = nr2.value[1]; | ||
return _overlap(l1, h1, l2, h2); | ||
} | ||
// istanbul ignore next | ||
(0, node_opcua_assert_1.assert)(false, "NumericalRange#overlap : case not implemented yet "); // TODO | ||
// istanbul ignore next | ||
return false; | ||
} | ||
isValid() { | ||
@@ -477,2 +477,5 @@ if (this.type === NumericRangeType.ArrayRange) { | ||
} | ||
else if (arr instanceof Buffer) { | ||
res = arr.subarray(start, end); | ||
} | ||
else { | ||
@@ -479,0 +482,0 @@ (0, node_opcua_assert_1.assert)(typeof arr.slice === "function"); |
{ | ||
"name": "node-opcua-numeric-range", | ||
"version": "2.85.0", | ||
"version": "2.86.0", | ||
"description": "pure nodejs OPCUA SDK - module -numeric-range", | ||
@@ -18,9 +18,9 @@ "main": "./dist/index.js", | ||
"node-opcua-assert": "2.77.0", | ||
"node-opcua-basic-types": "2.85.0", | ||
"node-opcua-binary-stream": "2.85.0", | ||
"node-opcua-factory": "2.85.0", | ||
"node-opcua-status-code": "2.85.0" | ||
"node-opcua-basic-types": "2.86.0", | ||
"node-opcua-binary-stream": "2.86.0", | ||
"node-opcua-factory": "2.86.0", | ||
"node-opcua-status-code": "2.86.0" | ||
}, | ||
"devDependencies": { | ||
"node-opcua-packet-analyzer": "2.85.0", | ||
"node-opcua-packet-analyzer": "2.86.0", | ||
"node-opcua-test-helpers": "2.77.0", | ||
@@ -42,3 +42,3 @@ "should": "^13.2.3" | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "68498fcf7b20ea9f7bd66e8529c546221daf5d52" | ||
"gitHead": "36afc46fe2c91aa5664a8c5418f4db5a354670c3" | ||
} |
@@ -586,2 +586,4 @@ /** | ||
res = (arr as any).subarray(start, end); | ||
} else if (arr instanceof Buffer) { | ||
res = arr.subarray(start, end); | ||
} else { | ||
@@ -588,0 +590,0 @@ assert(typeof (arr as any).slice === "function"); |
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
81343
1460
+ Addednode-opcua-basic-types@2.86.0(transitive)
+ Addednode-opcua-binary-stream@2.86.0(transitive)
+ Addednode-opcua-buffer-utils@2.86.0(transitive)
+ Addednode-opcua-date-time@2.86.0(transitive)
+ Addednode-opcua-debug@2.86.0(transitive)
+ Addednode-opcua-enum@2.86.0(transitive)
+ Addednode-opcua-factory@2.86.0(transitive)
+ Addednode-opcua-nodeid@2.86.0(transitive)
+ Addednode-opcua-status-code@2.86.0(transitive)
+ Addednode-opcua-utils@2.86.0(transitive)
- Removednode-opcua-basic-types@2.85.0(transitive)
- Removednode-opcua-binary-stream@2.85.0(transitive)
- Removednode-opcua-buffer-utils@2.85.0(transitive)
- Removednode-opcua-date-time@2.85.0(transitive)
- Removednode-opcua-debug@2.85.0(transitive)
- Removednode-opcua-enum@2.85.0(transitive)
- Removednode-opcua-factory@2.85.0(transitive)
- Removednode-opcua-nodeid@2.85.0(transitive)
- Removednode-opcua-status-code@2.85.0(transitive)
- Removednode-opcua-utils@2.85.0(transitive)
Updatednode-opcua-factory@2.86.0