Socket
Socket
Sign inDemoInstall

@formatjs/intl-relativetimeformat

Package Overview
Dependencies
Maintainers
3
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-relativetimeformat - npm Package Compare versions

Comparing version 9.2.3 to 9.3.0

15

lib/should-polyfill.js

@@ -9,4 +9,17 @@ function supportedLocalesOf(locale) {

}
function hasResolvedOptionsNumberingSystem(locale) {
try {
return ('numberingSystem' in
new Intl.RelativeTimeFormat(locale || 'en', {
numeric: 'auto',
}).resolvedOptions());
}
catch (_) {
return false;
}
}
export function shouldPolyfill(locale) {
return !('RelativeTimeFormat' in Intl) || !supportedLocalesOf(locale);
return (!('RelativeTimeFormat' in Intl) ||
!supportedLocalesOf(locale) ||
!hasResolvedOptionsNumberingSystem(locale));
}

2

package.json
{
"name": "@formatjs/intl-relativetimeformat",
"version": "9.2.3",
"version": "9.3.0",
"description": "Formats JavaScript dates to relative time strings.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -844,4 +844,13 @@ (function() {

}
function hasResolvedOptionsNumberingSystem(locale) {
try {
return "numberingSystem" in new Intl.RelativeTimeFormat(locale || "en", {
numeric: "auto"
}).resolvedOptions();
} catch (_) {
return false;
}
}
function shouldPolyfill(locale) {
return !("RelativeTimeFormat" in Intl) || !supportedLocalesOf(locale);
return !("RelativeTimeFormat" in Intl) || !supportedLocalesOf(locale) || !hasResolvedOptionsNumberingSystem(locale);
}

@@ -848,0 +857,0 @@

@@ -12,5 +12,18 @@ "use strict";

}
function hasResolvedOptionsNumberingSystem(locale) {
try {
return ('numberingSystem' in
new Intl.RelativeTimeFormat(locale || 'en', {
numeric: 'auto',
}).resolvedOptions());
}
catch (_) {
return false;
}
}
function shouldPolyfill(locale) {
return !('RelativeTimeFormat' in Intl) || !supportedLocalesOf(locale);
return (!('RelativeTimeFormat' in Intl) ||
!supportedLocalesOf(locale) ||
!hasResolvedOptionsNumberingSystem(locale));
}
exports.shouldPolyfill = shouldPolyfill;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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