Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@webassemblyjs/helper-numbers
Advanced tools
The @webassemblyjs/helper-numbers package provides utilities for handling numbers in WebAssembly modules. It includes functions for parsing and formatting numbers according to the WebAssembly specification. This can be particularly useful when working with WebAssembly binary files or generating WebAssembly code programmatically.
Parsing floating point numbers
This feature allows for the parsing of floating point numbers from their string representation into their binary format as used in WebAssembly. The code sample demonstrates parsing 32-bit and 64-bit floating point numbers.
"use strict";\nconst { parseF32, parseF64 } = require('@webassemblyjs/helper-numbers');\nconsole.log(parseF32('0x1.fffffep+127'));\nconsole.log(parseF64('0x1.fffffffffffffp+1023'));
Formatting floating point numbers
This feature enables the formatting of floating point numbers from their binary representation in WebAssembly to a human-readable string format. The code sample shows how to format 32-bit and 64-bit floating point numbers.
"use strict";\nconst { formatF32, formatF64 } = require('@webassemblyjs/helper-numbers');\nconsole.log(formatF32(1.5));\nconsole.log(formatF64(-1.5));
Parsing integer numbers
This functionality allows for the parsing of integer numbers from their string representation into their binary format as used in WebAssembly. The code sample demonstrates parsing 32-bit and 64-bit integer numbers.
"use strict";\nconst { parseI32, parseI64 } = require('@webassemblyjs/helper-numbers');\nconsole.log(parseI32('0xff'));\nconsole.log(parseI64('0xff'));
The 'long' package provides comprehensive support for 64-bit integers, including both signed and unsigned types. While it focuses on 64-bit integer arithmetic and comparison operations, it does not specifically cater to the WebAssembly number formats or parsing from specific encodings, making it less specialized for WebAssembly use cases compared to @webassemblyjs/helper-numbers.
bignumber.js is a library for arbitrary-precision decimal and non-decimal arithmetic. Unlike @webassemblyjs/helper-numbers, which is tailored for WebAssembly's number formats, bignumber.js offers a broader range of arithmetic operations and supports arbitrary precision, making it suitable for financial and other precision-critical applications.
FAQs
Number parsing utility
The npm package @webassemblyjs/helper-numbers receives a total of 14,335,054 weekly downloads. As such, @webassemblyjs/helper-numbers popularity was classified as popular.
We found that @webassemblyjs/helper-numbers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.