Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@messageformat/number-skeleton

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@messageformat/number-skeleton

A parser & formatter for ICU NumberFormat skeleton strings & patterns

  • 1.2.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @messageformat/number-skeleton?

@messageformat/number-skeleton is a utility for working with ICU Number Skeletons, which are a way to format numbers in a locale-aware manner. This package allows you to create, parse, and manipulate number skeletons to format numbers according to various internationalization (i18n) rules.

What are @messageformat/number-skeleton's main functionalities?

Creating Number Skeletons

This feature allows you to create a number skeleton for a specific format, such as currency. The code sample demonstrates creating a number skeleton for USD currency and formatting a number accordingly.

const { NumberSkeleton } = require('@messageformat/number-skeleton');
const skeleton = new NumberSkeleton('currency/USD');
console.log(skeleton.format(1234.56)); // $1,234.56

Parsing Number Skeletons

This feature allows you to parse a number skeleton string into a usable format. The code sample shows how to parse a number skeleton string and use it to format a number.

const { parseNumberSkeleton } = require('@messageformat/number-skeleton');
const skeleton = parseNumberSkeleton('currency/USD unit-width-narrow');
console.log(skeleton.format(1234.56)); // $1,234.56

Custom Number Formatting

This feature allows you to create custom number formats using number skeletons. The code sample demonstrates creating a number skeleton for percentage formatting with integer precision.

const { NumberSkeleton } = require('@messageformat/number-skeleton');
const skeleton = new NumberSkeleton('percent precision-integer');
console.log(skeleton.format(0.1234)); // 12%

Other packages similar to @messageformat/number-skeleton

Keywords

FAQs

Package last updated on 27 May 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc