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

lingui-formats

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lingui-formats - npm Package Compare versions

Comparing version 0.4.6 to 1.0.0-1

.npmignore

35

lib/index.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.number = exports.date = exports.NumberFormat = exports.DateFormat = undefined;
Object.defineProperty(exports, '__esModule', { value: true });
var _date = require('./date');
function date(language) {
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _date2 = _interopRequireDefault(_date);
// $FlowIgnore: DateTimeFormat is member of Intl
var formatter = new Intl.DateTimeFormat(language, format);
return function (value) {
return formatter.format(value);
};
}
var _number = require('./number');
function number(language) {
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _number2 = _interopRequireDefault(_number);
var formatter = new Intl.NumberFormat(language, format);
return function (value) {
return formatter.format(value);
};
}
var _createFormat = require('./createFormat');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var DateFormat = exports.DateFormat = (0, _createFormat.silentCreateFormat)(_date2.default);
var NumberFormat = exports.NumberFormat = (0, _createFormat.silentCreateFormat)(_number2.default);
exports.date = _date2.default;
exports.number = _number2.default;
exports.date = date;
exports.number = number;
{
"name": "lingui-formats",
"version": "0.4.6",
"version": "1.0.0-1",
"description": "Built-in formats for numbers and dates",

@@ -14,3 +14,10 @@ "main": "lib/index.js",

"i18n",
"internationalization"
"internationalization",
"l10n",
"localization",
"t9n",
"translation",
"icu",
"messageformat",
"intl"
],

@@ -17,0 +24,0 @@ "author": {

// @flow
type DateFormat = string | {}
type IntlType = {|
DateTimeFormat: Function
|};
const globalIntl: IntlType = window.Intl
function date (language: string, format?: DateFormat = {}): (value: string) => string {
const formatter = new globalIntl.DateTimeFormat(language, format)
// $FlowIgnore: DateTimeFormat is member of Intl
const formatter = new Intl.DateTimeFormat(language, format)
return value => formatter.format(value)

@@ -12,0 +8,0 @@ }

// @flow
import date from './date'
import number from './number'
import { silentCreateFormat } from './createFormat'
export const DateFormat = silentCreateFormat(date)
export const NumberFormat = silentCreateFormat(number)
export {
date,
number
}
export { default as date } from './date'
export { default as number } from './number'
// @flow
type NumberFormat = string | {}
type IntlType = {|
NumberFormat: Function
|};
const globalIntl: IntlType = window.Intl
function number (language: string, format?: NumberFormat = {}): (value: number) => string {
const formatter = new globalIntl.NumberFormat(language, format)
const formatter = new Intl.NumberFormat(language, format)
return value => formatter.format(value)

@@ -12,0 +7,0 @@ }

Sorry, the diff of this file is not supported yet

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