@polkadot/util
Advanced tools
Comparing version 9.5.2-1 to 9.5.2-2
@@ -8,6 +8,5 @@ "use strict"; | ||
var _string = require("../is/string"); | ||
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
@@ -20,3 +19,3 @@ /** | ||
function floatToU8a() { | ||
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '0.0'; | ||
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.0; | ||
let { | ||
@@ -34,16 +33,6 @@ bitLength = 32, | ||
if (value instanceof Number) { | ||
value = value.toString(); | ||
} | ||
if ((0, _string.isString)(value)) { | ||
if (bitLength === 32) { | ||
dv.setFloat32(0, parseFloat(value), isLe); | ||
} else { | ||
dv.setFloat64(0, parseFloat(value), isLe); | ||
} | ||
} else if (bitLength === 32) { | ||
dv.setFloat32(0, value, isLe); | ||
if (bitLength === 32) { | ||
dv.setFloat32(0, Number(value), isLe); | ||
} else { | ||
dv.setFloat64(0, value, isLe); | ||
dv.setFloat64(0, Number(value), isLe); | ||
} | ||
@@ -50,0 +39,0 @@ |
@@ -14,4 +14,4 @@ "use strict"; | ||
type: 'cjs', | ||
version: '9.5.2-1' | ||
version: '9.5.2-2' | ||
}; | ||
exports.packageInfo = packageInfo; |
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { isString } from "../is/string.js"; // eslint-disable-next-line @typescript-eslint/ban-types | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export function floatToU8a(value = '0.0', { | ||
export function floatToU8a(value = 0.0, { | ||
bitLength = 32, | ||
@@ -22,16 +22,6 @@ isLe = true | ||
if (value instanceof Number) { | ||
value = value.toString(); | ||
} | ||
if (isString(value)) { | ||
if (bitLength === 32) { | ||
dv.setFloat32(0, parseFloat(value), isLe); | ||
} else { | ||
dv.setFloat64(0, parseFloat(value), isLe); | ||
} | ||
} else if (bitLength === 32) { | ||
dv.setFloat32(0, value, isLe); | ||
if (bitLength === 32) { | ||
dv.setFloat32(0, Number(value), isLe); | ||
} else { | ||
dv.setFloat64(0, value, isLe); | ||
dv.setFloat64(0, Number(value), isLe); | ||
} | ||
@@ -38,0 +28,0 @@ |
@@ -23,3 +23,3 @@ { | ||
"type": "module", | ||
"version": "9.5.2-1", | ||
"version": "9.5.2-2", | ||
"main": "./cjs/index.js", | ||
@@ -718,6 +718,6 @@ "module": "./index.js", | ||
"@babel/runtime": "^7.18.3", | ||
"@polkadot/x-bigint": "9.5.2-1", | ||
"@polkadot/x-global": "9.5.2-1", | ||
"@polkadot/x-textdecoder": "9.5.2-1", | ||
"@polkadot/x-textencoder": "9.5.2-1", | ||
"@polkadot/x-bigint": "9.5.2-2", | ||
"@polkadot/x-global": "9.5.2-2", | ||
"@polkadot/x-textdecoder": "9.5.2-2", | ||
"@polkadot/x-textencoder": "9.5.2-2", | ||
"@types/bn.js": "^5.1.0", | ||
@@ -724,0 +724,0 @@ "bn.js": "^5.2.1", |
@@ -8,3 +8,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
type: 'esm', | ||
version: '9.5.2-1' | ||
version: '9.5.2-2' | ||
}; |
Sorry, the diff of this file is too big to display
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
530699
15202
+ Added@polkadot/x-bigint@9.5.2-2(transitive)
+ Added@polkadot/x-global@9.5.2-2(transitive)
+ Added@polkadot/x-textdecoder@9.5.2-2(transitive)
+ Added@polkadot/x-textencoder@9.5.2-2(transitive)
- Removed@polkadot/x-bigint@9.5.2-1(transitive)
- Removed@polkadot/x-global@9.5.2-1(transitive)
- Removed@polkadot/x-textdecoder@9.5.2-1(transitive)
- Removed@polkadot/x-textencoder@9.5.2-1(transitive)
Updated@polkadot/x-bigint@9.5.2-2
Updated@polkadot/x-global@9.5.2-2