
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
d3plus-format
Advanced tools
Shorthand formatters for common number types.
If you use NPM, run npm install d3plus-format --save
. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. You can also load directly from d3plus.org:
<script src="https://d3plus.org/js/d3plus-format.v0.1.full.min.js"></script>
1200000
to "1.2M"
).The new specifier strings added by d3plus-format are:
.3~a
- abbreviated decimal notation with a numeric suffix (ie. "k", "M", "B", etc). This is an alias of the formatAbbreviate
function.Name | Default | Description |
---|---|---|
separator | "" | Separation between the number with the suffix. |
suffixes | [] | List of suffixes used to format numbers. |
grouping | [3] | The array of group sizes, |
delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
currency | ["$", ""] | The currency prefix and suffix. |
Formats a number to an appropriate number of decimal places and rounding, adding suffixes if applicable (ie. 1200000
to "1.2M"
).
This is a global function.
Param | Type | Description |
---|---|---|
n | Number | String | The number to be formatted. |
locale | Object | String | The locale config to be used. If value is an object, the function will format the numbers according the object. The object must include suffixes , delimiter and currency properties. |
An extension to d3's format function that adds more string formatting types and localizations.
The new specifier strings added by d3plus-format are:
.3~a
- abbreviated decimal notation with a numeric suffix (ie. "k", "M", "B", etc). This is an alias of the formatAbbreviate
function.This is a global function.
An extension to d3's formatDefaultLocale function that allows setting the locale globally for formatters.
This is a global function.
A set of default locale formatters used when assigning suffixes and currency in numbers.
Name | Default | Description |
---|---|---|
separator | "" | Separation between the number with the suffix. |
suffixes | [] | List of suffixes used to format numbers. |
grouping | [3] | The array of group sizes, |
delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
currency | ["$", ""] | The currency prefix and suffix. |
This is a global namespace.
FAQs
Shorthand formatters for common number types.
The npm package d3plus-format receives a total of 651 weekly downloads. As such, d3plus-format popularity was classified as not popular.
We found that d3plus-format 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.