lingui-formats
Advanced tools
Comparing version 0.4.6 to 1.0.0-1
'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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
3218
10
53
1