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

react-i18nify

Package Overview
Dependencies
Maintainers
2
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-i18nify - npm Package Compare versions

Comparing version 1.11.9 to 1.11.10

17

build/lib/I18n.js

@@ -125,11 +125,20 @@ 'use strict';

var moduleAvailable = function moduleAvailable(name) {
try {
require.resolve(name);
return true;
} catch (e) {
// do nothing
}
return false;
};
if (options.dateFormat) {
try {
if (moduleAvailable('moment')) {
var moment = require('moment');
require('moment/min/locales');
return moment(value, options.parseFormat, this._locale, Boolean(options.strictParse)).format(this.t(options.dateFormat));
} catch (e) {
console.error('moment.js error', e);
return '';
}
console.error('Date formatting failed, please install moment.js');
return '';
}

@@ -136,0 +145,0 @@ if (typeof value === 'number') {

@@ -27,3 +27,3 @@ const React = require('react');

export_1: 'Export %{count} item',
two_lines: 'Line 1<br />Line 2',
two_lines: 'Line 1< sbr />Line 2',
},

@@ -30,0 +30,0 @@ nl: {

{
"name": "react-i18nify",
"version": "1.11.9",
"version": "1.11.10",
"description": "Simple i18n translation and localization components and helpers for React applications.",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

@@ -113,4 +113,14 @@ /* eslint global-require: "off" */

_localize(value, options = {}) {
const moduleAvailable = (name) => {
try {
require.resolve(name);
return true;
} catch (e) {
// do nothing
}
return false;
};
if (options.dateFormat) {
try {
if (moduleAvailable('moment')) {
const moment = require('moment');

@@ -124,6 +134,5 @@ require('moment/min/locales');

).format(this.t(options.dateFormat));
} catch (e) {
console.error('moment.js error', e);
return '';
}
console.error('Date formatting failed, please install moment.js');
return '';
}

@@ -130,0 +139,0 @@ if (typeof value === 'number') {

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