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

format-message

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-message - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

2

index.js

@@ -24,3 +24,3 @@ /* globals Intl */

var pattern = typeof msg === 'string' ? msg : msg.default
var id = typeof msg === 'object' && msg.id || generateId(pattern)
var id = (typeof msg === 'object' && msg.id) || generateId(pattern)
var key = locale + ':' + id

@@ -27,0 +27,0 @@ var format = cache[key] ||

{
"name": "format-message",
"version": "5.1.1",
"version": "5.1.2",
"description": "Internationalize text, numbers, and dates using ICU Message Format",

@@ -25,4 +25,4 @@ "author": "Andy VanWagoner <thetalecrafter@gmail.com> (https://thetalecrafter.com/)",

"format-message-formats": "^5.1.0",
"format-message-interpret": "^5.1.0",
"format-message-parse": "^5.1.0",
"format-message-interpret": "^5.1.2",
"format-message-parse": "^5.1.2",
"lookup-closest-locale": "^5.1.0",

@@ -29,0 +29,0 @@ "object-assign": "^4.0.1"

@@ -240,9 +240,9 @@ # ![format-message][logo]

{formatChildren(
formatMessage('Drag & Drop {extensions} files here _or_ __Browse__', {
formatMessage('Drag & Drop {extensions} files here <0>or</0> <1>Browse</1>', {
extensions
}),
{
_: <span className="or" />,
__: <span className="browse" />
}
[
<span className="or" />,
<span className="browse" />
]
)}

@@ -297,2 +297,21 @@ </div>

### String placeholders with nested data
```js
formatMessage('Welcome, {people.wes.name}, {people.julie.name}, and {people.sharon.name}!', {
people: {
wes: {
name: 'Wes Phillips'
},
julie: {
name: 'Julie Roberts'
},
sharon: {
name: 'Sharon Sanders'
}
}
})
// "Welcome, Wes Phillips, Julie Roberts, and Sharon Sanders!"
```
### Complex number, date, and time placeholders

@@ -299,0 +318,0 @@

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