node-opcua-basic-types 2.153.0 → 2.157.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boolean.d.ts +1 -1
- package/dist/boolean.js +4 -2
- package/dist/boolean.js.map +1 -1
- package/package.json +11 -11
- package/source/boolean.ts +5 -3
package/dist/boolean.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare function isValidBoolean(value: unknown): boolean;
|
|
|
3
3
|
export declare function randomBoolean(): boolean;
|
|
4
4
|
export declare function encodeBoolean(value: boolean, stream: OutputBinaryStream): void;
|
|
5
5
|
export declare function decodeBoolean(stream: BinaryStream, _value?: boolean): boolean;
|
|
6
|
-
export declare function coerceBoolean(value: string): boolean;
|
|
6
|
+
export declare function coerceBoolean(value: boolean | string | number | null | undefined): boolean;
|
|
7
7
|
export type UABoolean = boolean;
|
|
8
8
|
export declare const encodeUABoolean: typeof encodeBoolean;
|
|
9
9
|
export declare const decodeUABoolean: typeof decodeBoolean;
|
package/dist/boolean.js
CHANGED
|
@@ -25,9 +25,11 @@ function decodeBoolean(stream, _value) {
|
|
|
25
25
|
}
|
|
26
26
|
const falseDetectionRegex = /^(?:f(?:alse)?|no?|0+)$/i;
|
|
27
27
|
function coerceBoolean(value) {
|
|
28
|
+
if (value === null || value === undefined) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
28
31
|
// http://stackoverflow.com/a/24744599/406458
|
|
29
|
-
return !falseDetectionRegex.test(value) && !!value;
|
|
30
|
-
// return !!(+value||String(value).toLowerCase().replace(!!0,''));
|
|
32
|
+
return !falseDetectionRegex.test(value.toString()) && !!value;
|
|
31
33
|
}
|
|
32
34
|
exports.encodeUABoolean = encodeBoolean;
|
|
33
35
|
exports.decodeUABoolean = decodeBoolean;
|
package/dist/boolean.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../source/boolean.ts"],"names":[],"mappings":";;;AAMA,wCAEC;AAED,sCAEC;AAED,sCAGC;AAED,sCAEC;AAID,
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../source/boolean.ts"],"names":[],"mappings":";;;AAMA,wCAEC;AAED,sCAEC;AAED,sCAGC;AAED,sCAEC;AAID,sCAMC;AA/BD;;GAEG;AACH,yDAA2C;AAG3C,SAAgB,cAAc,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;AACtC,CAAC;AAED,SAAgB,aAAa;IACzB,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;AAC/B,CAAC;AAED,SAAgB,aAAa,CAAC,KAAc,EAAE,MAA0B;IACpE,IAAA,0BAAM,EAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,aAAa,CAAC,MAAoB,EAAE,MAAgB;IAChE,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAEvD,SAAgB,aAAa,CAAC,KAAiD;IAC3E,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,6CAA6C;IAC7C,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;AAClE,CAAC;AAGY,QAAA,eAAe,GAAG,aAAa,CAAC;AAChC,QAAA,eAAe,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-basic-types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.157.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module basic-types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"lint": "eslint source/*.ts"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"node-opcua-assert": "2.
|
|
15
|
-
"node-opcua-binary-stream": "2.
|
|
16
|
-
"node-opcua-buffer-utils": "2.
|
|
17
|
-
"node-opcua-date-time": "2.
|
|
18
|
-
"node-opcua-guid": "2.
|
|
19
|
-
"node-opcua-nodeid": "2.
|
|
20
|
-
"node-opcua-status-code": "2.
|
|
14
|
+
"node-opcua-assert": "2.157.0",
|
|
15
|
+
"node-opcua-binary-stream": "2.157.0",
|
|
16
|
+
"node-opcua-buffer-utils": "2.157.0",
|
|
17
|
+
"node-opcua-date-time": "2.157.0",
|
|
18
|
+
"node-opcua-guid": "2.157.0",
|
|
19
|
+
"node-opcua-nodeid": "2.157.0",
|
|
20
|
+
"node-opcua-status-code": "2.157.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"node-opcua-benchmarker": "2.
|
|
24
|
-
"node-opcua-debug": "2.
|
|
23
|
+
"node-opcua-benchmarker": "2.157.0",
|
|
24
|
+
"node-opcua-debug": "2.157.0"
|
|
25
25
|
},
|
|
26
26
|
"author": "Etienne Rossignon",
|
|
27
27
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"internet of things"
|
|
39
39
|
],
|
|
40
40
|
"homepage": "http://node-opcua.github.io/",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "e0a948ac5379ae8d9cc8200a1b4a31515a35be37",
|
|
42
42
|
"files": [
|
|
43
43
|
"dist",
|
|
44
44
|
"source"
|
package/source/boolean.ts
CHANGED
|
@@ -23,10 +23,12 @@ export function decodeBoolean(stream: BinaryStream, _value?: boolean): boolean {
|
|
|
23
23
|
|
|
24
24
|
const falseDetectionRegex = /^(?:f(?:alse)?|no?|0+)$/i;
|
|
25
25
|
|
|
26
|
-
export function coerceBoolean(value: string): boolean {
|
|
26
|
+
export function coerceBoolean(value: boolean | string|number | null | undefined): boolean {
|
|
27
|
+
if (value === null || value === undefined) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
27
30
|
// http://stackoverflow.com/a/24744599/406458
|
|
28
|
-
return !falseDetectionRegex.test(value) && !!value;
|
|
29
|
-
// return !!(+value||String(value).toLowerCase().replace(!!0,''));
|
|
31
|
+
return !falseDetectionRegex.test(value.toString()) && !!value;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export type UABoolean = boolean;
|