intl-messageformat-parser
Advanced tools
Comparing version 5.4.2 to 5.5.0
// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/24/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-messageformat-parser:dist-esm | ||
// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/1016/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-messageformat-parser:dist-esm | ||
// composite: false | ||
@@ -4,0 +4,0 @@ // declaration: true |
import { IParseOptions } from './src/parser'; | ||
import { Options } from './src/types'; | ||
export * from './src/types'; | ||
export * from './src/skeleton'; | ||
export declare type ParseOptions = Options & IParseOptions; | ||
export declare function parse(): void; | ||
//# sourceMappingURL=dummy.d.ts.map |
@@ -15,3 +15,2 @@ "use strict"; | ||
__exportStar(require("./src/types"), exports); | ||
__exportStar(require("./src/skeleton"), exports); | ||
function parse() { | ||
@@ -18,0 +17,0 @@ throw new Error("You're trying to format an uncompiled message with react-intl without parser, please import from 'react-int' instead"); |
@@ -5,5 +5,4 @@ import { IParseOptions } from './src/parser'; | ||
export * from './src/parser'; | ||
export * from './src/skeleton'; | ||
export declare type ParseOptions = Options & IParseOptions; | ||
export declare function parse(input: string, opts?: ParseOptions): MessageFormatElement[]; | ||
//# sourceMappingURL=index.d.ts.map |
15
index.js
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -18,6 +29,6 @@ if (k2 === undefined) k2 = k; | ||
__exportStar(require("./src/parser"), exports); | ||
__exportStar(require("./src/skeleton"), exports); | ||
function parse(input, opts) { | ||
opts = __assign({ normalizeHashtagInPlural: true, shouldParseSkeleton: true }, (opts || {})); | ||
var els = parser_1.pegParse(input, opts); | ||
if (!opts || opts.normalizeHashtagInPlural !== false) { | ||
if (opts.normalizeHashtagInPlural) { | ||
normalize_1.normalizeHashtagInPlural(els); | ||
@@ -24,0 +35,0 @@ } |
import { IParseOptions } from './src/parser'; | ||
import { Options } from './src/types'; | ||
export * from './src/types'; | ||
export * from './src/skeleton'; | ||
export declare type ParseOptions = Options & IParseOptions; | ||
export declare function parse(): void; | ||
//# sourceMappingURL=dummy.d.ts.map |
export * from './src/types'; | ||
export * from './src/skeleton'; | ||
export function parse() { | ||
throw new Error("You're trying to format an uncompiled message with react-intl without parser, please import from 'react-int' instead"); | ||
} |
@@ -5,5 +5,4 @@ import { IParseOptions } from './src/parser'; | ||
export * from './src/parser'; | ||
export * from './src/skeleton'; | ||
export declare type ParseOptions = Options & IParseOptions; | ||
export declare function parse(input: string, opts?: ParseOptions): MessageFormatElement[]; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,1 +1,12 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import { pegParse } from './src/parser'; | ||
@@ -5,6 +16,6 @@ import { normalizeHashtagInPlural } from './src/normalize'; | ||
export * from './src/parser'; | ||
export * from './src/skeleton'; | ||
export function parse(input, opts) { | ||
opts = __assign({ normalizeHashtagInPlural: true, shouldParseSkeleton: true }, (opts || {})); | ||
var els = pegParse(input, opts); | ||
if (!opts || opts.normalizeHashtagInPlural !== false) { | ||
if (opts.normalizeHashtagInPlural) { | ||
normalizeHashtagInPlural(els); | ||
@@ -11,0 +22,0 @@ } |
@@ -16,3 +16,3 @@ import { NumberSkeletonToken } from './types'; | ||
*/ | ||
export declare function convertNumberSkeletonToNumberFormatOptions(tokens: NumberSkeletonToken[]): NumberFormatOptions; | ||
export declare function parseNumberSkeleton(tokens: NumberSkeletonToken[]): NumberFormatOptions; | ||
//# sourceMappingURL=skeleton.d.ts.map |
@@ -116,3 +116,3 @@ var __assign = (this && this.__assign) || function () { | ||
case 'A': | ||
throw new RangeError('`S/A` (second) pattenrs are not supported, use `s` instead'); | ||
throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead'); | ||
// Zone | ||
@@ -128,3 +128,3 @@ case 'z': // 1..3, 4: specific non-location format | ||
case 'x': // 1, 2, 3, 4: The ISO8601 varios formats | ||
throw new RangeError('`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead'); | ||
throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead'); | ||
} | ||
@@ -211,3 +211,3 @@ return ''; | ||
*/ | ||
export function convertNumberSkeletonToNumberFormatOptions(tokens) { | ||
export function parseNumberSkeleton(tokens) { | ||
var result = {}; | ||
@@ -214,0 +214,0 @@ for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { |
@@ -103,2 +103,3 @@ export declare enum TYPE { | ||
location?: Location; | ||
parsedOptions: Intl.NumberFormatOptions; | ||
} | ||
@@ -109,2 +110,3 @@ export interface DateTimeSkeleton { | ||
location?: Location; | ||
parsedOptions: Intl.DateTimeFormatOptions; | ||
} | ||
@@ -136,2 +138,7 @@ export declare type Skeleton = NumberSkeleton | DateTimeSkeleton; | ||
/** | ||
* Whether to parse number/datetime skeleton | ||
* into Intl.NumberFormatOptions & Intl.DateTimeFormatOptions | ||
*/ | ||
shouldParseSkeletons?: boolean; | ||
/** | ||
* Capture location info in AST | ||
@@ -138,0 +145,0 @@ * Default is false |
{ | ||
"name": "intl-messageformat-parser", | ||
"version": "5.4.2", | ||
"version": "5.5.0", | ||
"description": "Parses ICU Message strings into an AST via JavaScript.", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@formatjs/intl-numberformat": "^5.5.0" | ||
"@formatjs/intl-numberformat": "^5.5.1" | ||
}, | ||
@@ -41,0 +41,0 @@ "homepage": "https://github.com/formatjs/formatjs", |
@@ -16,3 +16,3 @@ import { NumberSkeletonToken } from './types'; | ||
*/ | ||
export declare function convertNumberSkeletonToNumberFormatOptions(tokens: NumberSkeletonToken[]): NumberFormatOptions; | ||
export declare function parseNumberSkeleton(tokens: NumberSkeletonToken[]): NumberFormatOptions; | ||
//# sourceMappingURL=skeleton.d.ts.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertNumberSkeletonToNumberFormatOptions = exports.parseDateTimeSkeleton = void 0; | ||
exports.parseNumberSkeleton = exports.parseDateTimeSkeleton = void 0; | ||
/** | ||
@@ -120,3 +120,3 @@ * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table | ||
case 'A': | ||
throw new RangeError('`S/A` (second) pattenrs are not supported, use `s` instead'); | ||
throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead'); | ||
// Zone | ||
@@ -132,3 +132,3 @@ case 'z': // 1..3, 4: specific non-location format | ||
case 'x': // 1, 2, 3, 4: The ISO8601 varios formats | ||
throw new RangeError('`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead'); | ||
throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead'); | ||
} | ||
@@ -216,3 +216,3 @@ return ''; | ||
*/ | ||
function convertNumberSkeletonToNumberFormatOptions(tokens) { | ||
function parseNumberSkeleton(tokens) { | ||
var result = {}; | ||
@@ -317,2 +317,2 @@ for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { | ||
} | ||
exports.convertNumberSkeletonToNumberFormatOptions = convertNumberSkeletonToNumberFormatOptions; | ||
exports.parseNumberSkeleton = parseNumberSkeleton; |
@@ -103,2 +103,3 @@ export declare enum TYPE { | ||
location?: Location; | ||
parsedOptions: Intl.NumberFormatOptions; | ||
} | ||
@@ -109,2 +110,3 @@ export interface DateTimeSkeleton { | ||
location?: Location; | ||
parsedOptions: Intl.DateTimeFormatOptions; | ||
} | ||
@@ -136,2 +138,7 @@ export declare type Skeleton = NumberSkeleton | DateTimeSkeleton; | ||
/** | ||
* Whether to parse number/datetime skeleton | ||
* into Intl.NumberFormatOptions & Intl.DateTimeFormatOptions | ||
*/ | ||
shouldParseSkeletons?: boolean; | ||
/** | ||
* Capture location info in AST | ||
@@ -138,0 +145,0 @@ * Default is false |
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
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 too big to display
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
Sorry, the diff of this file is too big to display
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
305353
7989