lingui-formats
Advanced tools
Comparing version 1.0.0-3 to 1.0.0-4
@@ -0,6 +1,7 @@ | ||
var globalIntl = window.Intl; | ||
function date(language) { | ||
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
// $FlowIgnore: DateTimeFormat is member of Intl | ||
var formatter = new Intl.DateTimeFormat(language, format); | ||
var formatter = new globalIntl.DateTimeFormat(language, format); | ||
return function (value) { | ||
@@ -11,6 +12,8 @@ return formatter.format(value); | ||
var globalIntl$1 = window.Intl; | ||
function number(language) { | ||
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var formatter = new Intl.NumberFormat(language, format); | ||
var formatter = new globalIntl$1.NumberFormat(language, format); | ||
return function (value) { | ||
@@ -17,0 +20,0 @@ return formatter.format(value); |
@@ -5,7 +5,8 @@ 'use strict'; | ||
var globalIntl = window.Intl; | ||
function date(language) { | ||
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
// $FlowIgnore: DateTimeFormat is member of Intl | ||
var formatter = new Intl.DateTimeFormat(language, format); | ||
var formatter = new globalIntl.DateTimeFormat(language, format); | ||
return function (value) { | ||
@@ -16,6 +17,8 @@ return formatter.format(value); | ||
var globalIntl$1 = window.Intl; | ||
function number(language) { | ||
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var formatter = new Intl.NumberFormat(language, format); | ||
var formatter = new globalIntl$1.NumberFormat(language, format); | ||
return function (value) { | ||
@@ -22,0 +25,0 @@ return formatter.format(value); |
{ | ||
"name": "lingui-formats", | ||
"version": "1.0.0-3", | ||
"version": "1.0.0-4", | ||
"description": "Built-in formats for numbers and dates", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
// @flow | ||
type DateFormat = string | {} | ||
type IntlType = {| | ||
DateTimeFormat: Function | ||
|}; | ||
const globalIntl: IntlType = window.Intl | ||
function date (language: string, format?: DateFormat = {}): (value: string) => string { | ||
// $FlowIgnore: DateTimeFormat is member of Intl | ||
const formatter = new Intl.DateTimeFormat(language, format) | ||
const formatter = new globalIntl.DateTimeFormat(language, format) | ||
return value => formatter.format(value) | ||
@@ -8,0 +12,0 @@ } |
// @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 Intl.NumberFormat(language, format) | ||
const formatter = new globalIntl.NumberFormat(language, format) | ||
return value => formatter.format(value) | ||
@@ -7,0 +12,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3559
62