
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@flourish/formatters
Advanced tools
Flourish module for formatting numbers and dates using the format id's of the interpreter module.
To install the module, type:
npm install @flourish/formatters
To add the module's settings block for number formatting, include something like the following in a templates' template.yml file:
- property: x_format
import: "@flourish/formatters/number-formatter"
Since you may well want different formatting for different variables or axes, it is quite likely you may want to include multiple settings blocks:
- property: y_format
import: "@flourish/formatters/number-formatter"
This function return a formatter function with the given format_id
. For example:
import { getFormatter } from @flourish/formatter;
const numFormat = getFormatter("number$point_comma");
console.log(numFormat(12235.56)); // "12.235,56"
const dateFormat = getFormatter("datetime$%d/%m/%Y");
console.log(dateFormat(Date.now())); // "20/01/2022"
This function returns a function for generating a number-formatting function with additional properties that can be specified by the user of the template via the settings panel when the settings.yml from the number-formatter folder is included in the template.yml file. For example...
- Number formatting
- property: formatting
import: "@flourish/formatters/number-formatter"
// In state.js
const state = {
...
formatting = {};
...
}
// In draw.js
...
const getNumberFormatter = initNumberFormatter(state.formatting);
function draw() {
...
}
// In update.js
function update() {
...
const numberFormatter = getNumberFormatter(output_id);
const label = numberFormatter(value);
...
}
FAQs
Format numbers and datetimes
The npm package @flourish/formatters receives a total of 372 weekly downloads. As such, @flourish/formatters popularity was classified as not popular.
We found that @flourish/formatters demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 24 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.