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

@polkadot/util

Package Overview
Dependencies
Maintainers
2
Versions
1411
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/util - npm Package Compare versions

Comparing version 9.5.2-1 to 9.5.2-2

21

cjs/float/toU8a.js

@@ -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

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