Socket
Socket
Sign inDemoInstall

@types/d3-format

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-format

TypeScript definitions for D3JS d3-format module


Version published
Weekly downloads
2.1M
decreased by-2.2%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-format?

The @types/d3-format package provides TypeScript type definitions for the d3-format module, which is a JavaScript library for formatting numbers for human consumption. It allows developers to format numbers in various ways, such as currency, percentage, precision, and more. The type definitions enable TypeScript developers to use d3-format with type checking and IntelliSense in their IDEs.

What are @types/d3-format's main functionalities?

Number Formatting

Format numbers to a fixed number of decimal places.

import { format } from 'd3-format';
const formatter = format('.2f');
const formattedNumber = formatter(123.456); // '123.46'

Currency Formatting

Format numbers as currency, including symbol, comma separation, and decimal precision.

import { format } from 'd3-format';
const currencyFormatter = format('$,.2f');
const formattedCurrency = currencyFormatter(1234.56); // '$1,234.56'

Percentage Formatting

Format numbers as percentages with rounding and no decimal places.

import { format } from 'd3-format';
const percentFormatter = format('.0%');
const formattedPercent = percentFormatter(0.123); // '12%'

SI Prefix Formatting

Format numbers using SI prefixes with a specified precision.

import { format } from 'd3-format';
const siFormatter = format('.3s');
const formattedSI = siFormatter(123456); // '123k'

Other packages similar to @types/d3-format

FAQs

Package last updated on 22 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc