Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
defi-numbers
Advanced tools
Number formatting and utilities for DeFi apps.
npm i defi-numbers
import { fNum } from "defi-numbers";
// Token amounts
fNum("token", "12345"); // -> 12.35k
fNum("token", "12345", { abbreviated: false }); // -> 12,345
fNum("token", "0.001234"); // -> 0.0012
fNum("token", "0.00001"); // -> < 0.00001
// Fiat values
fNum("fiat", "1234.56"); // -> 1.23k
fNum("fiat", "1234.56", { abbreviated: false }); // -> 1,234.56
fNum("fiat", "0.001"); // -> < 0.01
// Percentages
fNum("percentage", "0.10"); // -> 10%
fNum("percentage", "0.001"); // -> 0.1%
fNum("percentage", "0.00001"); // -> < 0.01%
// Integers
fNum("integer", "1234567"); // -> 1,234,567
fNum("integer", "0.123"); // -> 0
import { bn, safeSum, blockInvalidNumberInput } from "defi-numbers";
// Create BigNumber instances
bn("123.456").gte(100); // -> true
// Sum array of numbers safely
safeSum(["0.1", "0.2", "0.3"]); // -> "0.6"
// Block invalid number input in React
<input type="number" onKeyDown={blockInvalidNumberInput} />;
Gareth Fuller 💻 🖋 📖 🤔 🚇 🚧 📆 🔧 |
FAQs
Number formatting and utilities for DeFi apps.
The npm package defi-numbers receives a total of 5 weekly downloads. As such, defi-numbers popularity was classified as not popular.
We found that defi-numbers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.