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

intl-messageformat-parser

Package Overview
Dependencies
Maintainers
4
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-messageformat-parser - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

6

build.js

@@ -25,3 +25,3 @@ #!/usr/bin/env node

NumberSkeleton,
DateSkeleton,
DateTimeSkeleton,
SKELETON_TYPE,

@@ -52,5 +52,5 @@ TYPE,

numberSkeleton: 'NumberSkeleton',
dateOrTimeSkeleton: 'DateSkeleton',
dateTimeSkeleton: 'DateTimeSkeleton',
numberArgStyle: 'string | NumberSkeleton',
dateOrTimeArgStyle: 'string | DateSkeleton',
dateTimeArgStyle: 'string | DateTimeSkeleton',
simpleFormatElement: `

@@ -57,0 +57,0 @@ | NumberElement

@@ -6,2 +6,13 @@ # Change Log

## [3.0.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.3...intl-messageformat-parser@3.0.4) (2019-08-08)
### Bug Fixes
* **intl-messageformat-parser:** make date time skeleton compatib… ([#140](https://github.com/formatjs/formatjs/issues/140)) ([b6ea222](https://github.com/formatjs/formatjs/commit/b6ea222))
## [3.0.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.2...intl-messageformat-parser@3.0.3) (2019-08-07)

@@ -8,0 +19,0 @@

@@ -1,2 +0,3 @@

import { MessageFormatElement } from './types';
import { MessageFormatElement, DateTimeSkeleton } from './types';
export declare function printAST(ast: MessageFormatElement[]): string;
export declare function printDateTimeSkeleton(style: DateTimeSkeleton): string;

@@ -54,4 +54,4 @@ "use strict";

}
else if (style.type === 1 /* date */) {
return "::" + printEscapedMessage(style.pattern);
else if (style.type === 1 /* dateTime */) {
return "::" + printDateTimeSkeleton(style);
}

@@ -62,2 +62,6 @@ else {

}
function printDateTimeSkeleton(style) {
return style.pattern;
}
exports.printDateTimeSkeleton = printDateTimeSkeleton;
function printSelectElement(el) {

@@ -64,0 +68,0 @@ var msg = [

@@ -33,3 +33,3 @@ export declare enum TYPE {

number = 0,
date = 1
dateTime = 1
}

@@ -56,4 +56,4 @@ export interface LocationDetails {

export declare type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>;
export declare type DateElement = SimpleFormatElement<TYPE.date, DateSkeleton>;
export declare type TimeElement = SimpleFormatElement<TYPE.time, DateSkeleton>;
export declare type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>;
export declare type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>;
export interface SelectOption {

@@ -87,8 +87,8 @@ id: string;

}
export interface DateSkeleton {
type: SKELETON_TYPE.date;
export interface DateTimeSkeleton {
type: SKELETON_TYPE.dateTime;
pattern: string;
location?: Location;
}
export declare type Skeleton = NumberSkeleton | DateSkeleton;
export declare type Skeleton = NumberSkeleton | DateTimeSkeleton;
/**

@@ -105,3 +105,3 @@ * Type Guards

export declare function isNumberSkeleton(el: Skeleton): el is NumberSkeleton;
export declare function isDateSkeleton(el: Skeleton): el is DateSkeleton;
export declare function isDateTimeSkeleton(el: Skeleton): el is DateTimeSkeleton;
export declare function createLiteralElement(value: string): LiteralElement;

@@ -108,0 +108,0 @@ export declare function createNumberElement(value: string, style?: string | null): NumberElement;

@@ -69,6 +69,6 @@ "use strict";

exports.isNumberSkeleton = isNumberSkeleton;
function isDateSkeleton(el) {
return el.type === 1 /* date */;
function isDateTimeSkeleton(el) {
return el.type === 1 /* dateTime */;
}
exports.isDateSkeleton = isDateSkeleton;
exports.isDateTimeSkeleton = isDateTimeSkeleton;
function createLiteralElement(value) {

@@ -75,0 +75,0 @@ return {

{
"name": "intl-messageformat-parser",
"version": "3.0.3",
"version": "3.0.4",
"description": "Parses ICU Message strings into an AST via JavaScript.",

@@ -46,3 +46,3 @@ "main": "dist/index",

"homepage": "https://github.com/formatjs/formatjs",
"gitHead": "e4991d253408fd29bbdbf20f9d133fa7f3714ac0"
"gitHead": "6e67775d81ba150bf565c9b49ffee06b48fddbcb"
}

@@ -27,3 +27,3 @@ // tslint:disable:only-arrow-functions

NumberSkeleton,
DateSkeleton,
DateTimeSkeleton,
SKELETON_TYPE,

@@ -249,5 +249,13 @@ TYPE,

};
const peg$c28 = function(pattern: any): any {
const peg$c28 = "'";
const peg$c29 = peg$literalExpectation("'", false);
const peg$c30 = /^[^']/;
const peg$c31 = peg$classExpectation(["'"], true, false);
const peg$c32 = /^[^a-zA-Z'{}]/;
const peg$c33 = peg$classExpectation([["a", "z"], ["A", "Z"], "'", "{", "}"], true, false);
const peg$c34 = /^[a-zA-Z]/;
const peg$c35 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
const peg$c36 = function(pattern: any): any {
return {
type: SKELETON_TYPE.date,
type: SKELETON_TYPE.dateTime,
pattern,

@@ -257,13 +265,13 @@ ...insertLocation(),

};
const peg$c29 = "date";
const peg$c30 = peg$literalExpectation("date", false);
const peg$c31 = "time";
const peg$c32 = peg$literalExpectation("time", false);
const peg$c33 = "plural";
const peg$c34 = peg$literalExpectation("plural", false);
const peg$c35 = "selectordinal";
const peg$c36 = peg$literalExpectation("selectordinal", false);
const peg$c37 = "offset:";
const peg$c38 = peg$literalExpectation("offset:", false);
const peg$c39 = function(value: any, pluralType: any, offset: any, options: any): any {
const peg$c37 = "date";
const peg$c38 = peg$literalExpectation("date", false);
const peg$c39 = "time";
const peg$c40 = peg$literalExpectation("time", false);
const peg$c41 = "plural";
const peg$c42 = peg$literalExpectation("plural", false);
const peg$c43 = "selectordinal";
const peg$c44 = peg$literalExpectation("selectordinal", false);
const peg$c45 = "offset:";
const peg$c46 = peg$literalExpectation("offset:", false);
const peg$c47 = function(value: any, pluralType: any, offset: any, options: any): any {
return {

@@ -284,5 +292,5 @@ type : TYPE.plural,

};
const peg$c40 = "select";
const peg$c41 = peg$literalExpectation("select", false);
const peg$c42 = function(value: any, options: any): any {
const peg$c48 = "select";
const peg$c49 = peg$literalExpectation("select", false);
const peg$c50 = function(value: any, options: any): any {
return {

@@ -301,5 +309,5 @@ type : TYPE.select,

};
const peg$c43 = "=";
const peg$c44 = peg$literalExpectation("=", false);
const peg$c45 = function(id: any, value: any): any {
const peg$c51 = "=";
const peg$c52 = peg$literalExpectation("=", false);
const peg$c53 = function(id: any, value: any): any {
return {

@@ -311,3 +319,3 @@ id,

};
const peg$c46 = function(id: any, value: any): any {
const peg$c54 = function(id: any, value: any): any {
return {

@@ -319,29 +327,25 @@ id,

};
const peg$c47 = /^[\t-\r \x85\u200E\u200F\u2028\u2029]/;
const peg$c48 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029"], false, false);
const peg$c49 = /^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/;
const peg$c50 = peg$classExpectation([["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], false, false);
const peg$c51 = peg$otherExpectation("optional whitespace");
const peg$c52 = /^[0-9]/;
const peg$c53 = peg$classExpectation([["0", "9"]], false, false);
const peg$c54 = function(digits: any): any {
const peg$c55 = /^[\t-\r \x85\u200E\u200F\u2028\u2029]/;
const peg$c56 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029"], false, false);
const peg$c57 = /^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/;
const peg$c58 = peg$classExpectation([["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], false, false);
const peg$c59 = peg$otherExpectation("optional whitespace");
const peg$c60 = /^[0-9]/;
const peg$c61 = peg$classExpectation([["0", "9"]], false, false);
const peg$c62 = function(digits: any): any {
return parseInt(digits.join(''), 10);
};
const peg$c55 = peg$otherExpectation("apostrophe");
const peg$c56 = "'";
const peg$c57 = peg$literalExpectation("'", false);
const peg$c58 = peg$otherExpectation("double apostrophes");
const peg$c59 = "''";
const peg$c60 = peg$literalExpectation("''", false);
const peg$c61 = function(): any { return `'`; };
const peg$c62 = /^[{}]/;
const peg$c63 = peg$classExpectation(["{", "}"], false, false);
const peg$c64 = /^[^']/;
const peg$c65 = peg$classExpectation(["'"], true, false);
const peg$c66 = function(escapedChar: any, quotedChars: any): any {
const peg$c63 = peg$otherExpectation("apostrophe");
const peg$c64 = peg$otherExpectation("double apostrophes");
const peg$c65 = "''";
const peg$c66 = peg$literalExpectation("''", false);
const peg$c67 = function(): any { return `'`; };
const peg$c68 = /^[{}]/;
const peg$c69 = peg$classExpectation(["{", "}"], false, false);
const peg$c70 = function(escapedChar: any, quotedChars: any): any {
return escapedChar + quotedChars.replace(`''`, `'`);
};
const peg$c67 = /^[^{}]/;
const peg$c68 = peg$classExpectation(["{", "}"], true, false);
const peg$c69 = peg$otherExpectation("keyword");
const peg$c71 = /^[^{}]/;
const peg$c72 = peg$classExpectation(["{", "}"], true, false);
const peg$c73 = peg$otherExpectation("keyword");

@@ -1027,10 +1031,157 @@ let peg$currPos = 0;

function peg$parsedateOrTimeSkeleton(): DateSkeleton {
function peg$parsedateTimeSkeletonLiteral(): any {
let s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c28;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsedoubleApostrophes();
if (s3 === peg$FAILED) {
if (peg$c30.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsedoubleApostrophes();
if (s3 === peg$FAILED) {
if (peg$c30.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c28;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = [];
s1 = peg$parsedoubleApostrophes();
if (s1 === peg$FAILED) {
if (peg$c32.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
}
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parsedoubleApostrophes();
if (s1 === peg$FAILED) {
if (peg$c32.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
}
}
}
} else {
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsedateTimeSkeletonPattern(): any {
let s0, s1;
s0 = [];
if (peg$c34.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c34.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}
}
} else {
s0 = peg$FAILED;
}
return s0;
}
function peg$parsedateTimeSkeleton(): DateTimeSkeleton {
let s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsemessageText();
s1 = peg$currPos;
s2 = [];
s3 = peg$parsedateTimeSkeletonLiteral();
if (s3 === peg$FAILED) {
s3 = peg$parsedateTimeSkeletonPattern();
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsedateTimeSkeletonLiteral();
if (s3 === peg$FAILED) {
s3 = peg$parsedateTimeSkeletonPattern();
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c28(s1);
s1 = peg$c36(s1);
}

@@ -1042,3 +1193,3 @@ s0 = s1;

function peg$parsedateOrTimeArgStyle(): string | DateSkeleton {
function peg$parsedateOrTimeArgStyle(): any {
let s0, s1, s2;

@@ -1055,3 +1206,3 @@

if (s1 !== peg$FAILED) {
s2 = peg$parsedateOrTimeSkeleton();
s2 = peg$parsedateTimeSkeleton();
if (s2 !== peg$FAILED) {

@@ -1110,16 +1261,16 @@ peg$savedPos = s0;

if (s6 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c29) {
s7 = peg$c29;
if (input.substr(peg$currPos, 4) === peg$c37) {
s7 = peg$c37;
peg$currPos += 4;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c30); }
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s7 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c31) {
s7 = peg$c31;
if (input.substr(peg$currPos, 4) === peg$c39) {
s7 = peg$c39;
peg$currPos += 4;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}

@@ -1265,16 +1416,16 @@ }

if (s6 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c33) {
s7 = peg$c33;
if (input.substr(peg$currPos, 6) === peg$c41) {
s7 = peg$c41;
peg$currPos += 6;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c34); }
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
if (s7 === peg$FAILED) {
if (input.substr(peg$currPos, 13) === peg$c35) {
s7 = peg$c35;
if (input.substr(peg$currPos, 13) === peg$c43) {
s7 = peg$c43;
peg$currPos += 13;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c36); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}

@@ -1296,8 +1447,8 @@ }

s11 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c37) {
s12 = peg$c37;
if (input.substr(peg$currPos, 7) === peg$c45) {
s12 = peg$c45;
peg$currPos += 7;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}

@@ -1351,3 +1502,3 @@ if (s12 !== peg$FAILED) {

peg$savedPos = s0;
s1 = peg$c39(s3, s7, s11, s13);
s1 = peg$c47(s3, s7, s11, s13);
s0 = s1;

@@ -1446,8 +1597,8 @@ } else {

if (s6 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c40) {
s7 = peg$c40;
if (input.substr(peg$currPos, 6) === peg$c48) {
s7 = peg$c48;
peg$currPos += 6;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c41); }
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}

@@ -1489,3 +1640,3 @@ if (s7 !== peg$FAILED) {

peg$savedPos = s0;
s1 = peg$c42(s3, s11);
s1 = peg$c50(s3, s11);
s0 = s1;

@@ -1554,7 +1705,7 @@ } else {

if (input.charCodeAt(peg$currPos) === 61) {
s2 = peg$c43;
s2 = peg$c51;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c44); }
if (peg$silentFails === 0) { peg$fail(peg$c52); }
}

@@ -1615,3 +1766,3 @@ if (s2 !== peg$FAILED) {

peg$savedPos = s0;
s1 = peg$c45(s2, s5);
s1 = peg$c53(s2, s5);
s0 = s1;

@@ -1675,3 +1826,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c46(s2, s5);
s1 = peg$c54(s2, s5);
s0 = s1;

@@ -1709,3 +1860,3 @@ } else {

if (peg$c47.test(input.charAt(peg$currPos))) {
if (peg$c55.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1715,3 +1866,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c48); }
if (peg$silentFails === 0) { peg$fail(peg$c56); }
}

@@ -1725,3 +1876,3 @@

if (peg$c49.test(input.charAt(peg$currPos))) {
if (peg$c57.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1731,3 +1882,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c50); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}

@@ -1757,3 +1908,3 @@

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
if (peg$silentFails === 0) { peg$fail(peg$c59); }
}

@@ -1769,3 +1920,3 @@

s1 = [];
if (peg$c52.test(input.charAt(peg$currPos))) {
if (peg$c60.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1775,3 +1926,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}

@@ -1781,3 +1932,3 @@ if (s2 !== peg$FAILED) {

s1.push(s2);
if (peg$c52.test(input.charAt(peg$currPos))) {
if (peg$c60.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1787,3 +1938,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}

@@ -1796,3 +1947,3 @@ }

peg$savedPos = s0;
s1 = peg$c54(s1);
s1 = peg$c62(s1);
}

@@ -1809,7 +1960,7 @@ s0 = s1;

if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c56;
s0 = peg$c28;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}

@@ -1819,3 +1970,3 @@ peg$silentFails--;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}

@@ -1831,12 +1982,12 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c65) {
s1 = peg$c65;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c61();
s1 = peg$c67();
}

@@ -1847,3 +1998,3 @@ s0 = s1;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c58); }
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}

@@ -1859,10 +2010,10 @@

if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c56;
s1 = peg$c28;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s1 !== peg$FAILED) {
if (peg$c62.test(input.charAt(peg$currPos))) {
if (peg$c68.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1872,3 +2023,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
if (peg$silentFails === 0) { peg$fail(peg$c69); }
}

@@ -1878,11 +2029,11 @@ if (s2 !== peg$FAILED) {

s4 = [];
if (input.substr(peg$currPos, 2) === peg$c59) {
s5 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c65) {
s5 = peg$c65;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s5 === peg$FAILED) {
if (peg$c64.test(input.charAt(peg$currPos))) {
if (peg$c30.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);

@@ -1892,3 +2043,3 @@ peg$currPos++;

s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c65); }
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}

@@ -1898,11 +2049,11 @@ }

s4.push(s5);
if (input.substr(peg$currPos, 2) === peg$c59) {
s5 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c65) {
s5 = peg$c65;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s5 === peg$FAILED) {
if (peg$c64.test(input.charAt(peg$currPos))) {
if (peg$c30.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);

@@ -1912,3 +2063,3 @@ peg$currPos++;

s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c65); }
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}

@@ -1924,11 +2075,11 @@ }

if (input.charCodeAt(peg$currPos) === 39) {
s4 = peg$c56;
s4 = peg$c28;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c66(s2, s3);
s1 = peg$c70(s2, s3);
s0 = s1;

@@ -1959,3 +2110,3 @@ } else {

s0 = peg$currPos;
if (peg$c67.test(input.charAt(peg$currPos))) {
if (peg$c71.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1965,3 +2116,3 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c68); }
if (peg$silentFails === 0) { peg$fail(peg$c72); }
}

@@ -2064,3 +2215,3 @@ if (s1 !== peg$FAILED) {

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c69); }
if (peg$silentFails === 0) { peg$fail(peg$c73); }
}

@@ -2067,0 +2218,0 @@

@@ -26,3 +26,4 @@ /*

SKELETON_TYPE,
NumberSkeletonToken
NumberSkeletonToken,
DateTimeSkeleton
} from './types';

@@ -85,4 +86,4 @@

return printEscapedMessage(style);
} else if (style.type === SKELETON_TYPE.date) {
return `::${printEscapedMessage(style.pattern)}`;
} else if (style.type === SKELETON_TYPE.dateTime) {
return `::${printDateTimeSkeleton(style)}`;
} else {

@@ -93,2 +94,6 @@ return `::${style.tokens.map(printNumberSkeletonToken).join(' ')}`;

export function printDateTimeSkeleton(style: DateTimeSkeleton): string {
return style.pattern;
}
function printSelectElement(el: SelectElement) {

@@ -95,0 +100,0 @@ const msg = [

@@ -34,3 +34,3 @@ export enum TYPE {

number,
date
dateTime
}

@@ -63,4 +63,4 @@

export type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>;
export type DateElement = SimpleFormatElement<TYPE.date, DateSkeleton>;
export type TimeElement = SimpleFormatElement<TYPE.time, DateSkeleton>;
export type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>;
export type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>;

@@ -117,4 +117,4 @@ export interface SelectOption {

export interface DateSkeleton {
type: SKELETON_TYPE.date;
export interface DateTimeSkeleton {
type: SKELETON_TYPE.dateTime;
pattern: string;

@@ -124,3 +124,3 @@ location?: Location;

export type Skeleton = NumberSkeleton | DateSkeleton;
export type Skeleton = NumberSkeleton | DateTimeSkeleton;

@@ -158,4 +158,4 @@ /**

}
export function isDateSkeleton(el: Skeleton): el is DateSkeleton {
return el.type === SKELETON_TYPE.date;
export function isDateTimeSkeleton(el: Skeleton): el is DateTimeSkeleton {
return el.type === SKELETON_TYPE.dateTime;
}

@@ -162,0 +162,0 @@

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 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