@svta/cml-structured-field-values 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/index.d.ts +391 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +710 -13
- package/dist/index.js.map +1 -1
- package/package.json +4 -23
- package/NOTICE +0 -36
- package/dist/SfBareItem.d.ts +0 -9
- package/dist/SfBareItem.d.ts.map +0 -1
- package/dist/SfBareItem.js +0 -2
- package/dist/SfBareItem.js.map +0 -1
- package/dist/SfDecodeOptions.d.ts +0 -13
- package/dist/SfDecodeOptions.d.ts.map +0 -1
- package/dist/SfDecodeOptions.js +0 -2
- package/dist/SfDecodeOptions.js.map +0 -1
- package/dist/SfDictionary.d.ts +0 -9
- package/dist/SfDictionary.d.ts.map +0 -1
- package/dist/SfDictionary.js +0 -2
- package/dist/SfDictionary.js.map +0 -1
- package/dist/SfEncodeOptions.d.ts +0 -13
- package/dist/SfEncodeOptions.d.ts.map +0 -1
- package/dist/SfEncodeOptions.js +0 -2
- package/dist/SfEncodeOptions.js.map +0 -1
- package/dist/SfInnerList.d.ts +0 -14
- package/dist/SfInnerList.d.ts.map +0 -1
- package/dist/SfInnerList.js +0 -2
- package/dist/SfInnerList.js.map +0 -1
- package/dist/SfItem.d.ts +0 -14
- package/dist/SfItem.d.ts.map +0 -1
- package/dist/SfItem.js +0 -16
- package/dist/SfItem.js.map +0 -1
- package/dist/SfMember.d.ts +0 -11
- package/dist/SfMember.d.ts.map +0 -1
- package/dist/SfMember.js +0 -2
- package/dist/SfMember.js.map +0 -1
- package/dist/SfParameters.d.ts +0 -8
- package/dist/SfParameters.d.ts.map +0 -1
- package/dist/SfParameters.js +0 -2
- package/dist/SfParameters.js.map +0 -1
- package/dist/SfToken.d.ts +0 -11
- package/dist/SfToken.d.ts.map +0 -1
- package/dist/SfToken.js +0 -12
- package/dist/SfToken.js.map +0 -1
- package/dist/decodeSfDict.d.ts +0 -13
- package/dist/decodeSfDict.d.ts.map +0 -1
- package/dist/decodeSfDict.js +0 -25
- package/dist/decodeSfDict.js.map +0 -1
- package/dist/decodeSfItem.d.ts +0 -13
- package/dist/decodeSfItem.d.ts.map +0 -1
- package/dist/decodeSfItem.js +0 -46
- package/dist/decodeSfItem.js.map +0 -1
- package/dist/decodeSfList.d.ts +0 -13
- package/dist/decodeSfList.d.ts.map +0 -1
- package/dist/decodeSfList.js +0 -25
- package/dist/decodeSfList.js.map +0 -1
- package/dist/encodeSfDict.d.ts +0 -14
- package/dist/encodeSfDict.d.ts.map +0 -1
- package/dist/encodeSfDict.js +0 -16
- package/dist/encodeSfDict.js.map +0 -1
- package/dist/encodeSfItem.d.ts +0 -26
- package/dist/encodeSfItem.d.ts.map +0 -1
- package/dist/encodeSfItem.js +0 -9
- package/dist/encodeSfItem.js.map +0 -1
- package/dist/encodeSfList.d.ts +0 -15
- package/dist/encodeSfList.d.ts.map +0 -1
- package/dist/encodeSfList.js +0 -16
- package/dist/encodeSfList.js.map +0 -1
- package/dist/parse/ParsedValue.d.ts +0 -6
- package/dist/parse/ParsedValue.d.ts.map +0 -1
- package/dist/parse/ParsedValue.js +0 -4
- package/dist/parse/ParsedValue.js.map +0 -1
- package/dist/parse/index.d.ts +0 -22
- package/dist/parse/index.d.ts.map +0 -1
- package/dist/parse/index.js +0 -21
- package/dist/parse/index.js.map +0 -1
- package/dist/parse/parseBareItem.d.ts +0 -5
- package/dist/parse/parseBareItem.d.ts.map +0 -1
- package/dist/parse/parseBareItem.js +0 -59
- package/dist/parse/parseBareItem.js.map +0 -1
- package/dist/parse/parseBoolean.d.ts +0 -3
- package/dist/parse/parseBoolean.d.ts.map +0 -1
- package/dist/parse/parseBoolean.js +0 -34
- package/dist/parse/parseBoolean.js.map +0 -1
- package/dist/parse/parseByteSequence.d.ts +0 -3
- package/dist/parse/parseByteSequence.d.ts.map +0 -1
- package/dist/parse/parseByteSequence.js +0 -59
- package/dist/parse/parseByteSequence.js.map +0 -1
- package/dist/parse/parseDate.d.ts +0 -3
- package/dist/parse/parseDate.d.ts.map +0 -1
- package/dist/parse/parseDate.js +0 -32
- package/dist/parse/parseDate.js.map +0 -1
- package/dist/parse/parseDict.d.ts +0 -5
- package/dist/parse/parseDict.d.ts.map +0 -1
- package/dist/parse/parseDict.js +0 -90
- package/dist/parse/parseDict.js.map +0 -1
- package/dist/parse/parseError.d.ts +0 -2
- package/dist/parse/parseError.d.ts.map +0 -1
- package/dist/parse/parseError.js +0 -5
- package/dist/parse/parseError.js.map +0 -1
- package/dist/parse/parseInnerList.d.ts +0 -5
- package/dist/parse/parseInnerList.d.ts.map +0 -1
- package/dist/parse/parseInnerList.js +0 -62
- package/dist/parse/parseInnerList.js.map +0 -1
- package/dist/parse/parseIntegerOrDecimal.d.ts +0 -3
- package/dist/parse/parseIntegerOrDecimal.d.ts.map +0 -1
- package/dist/parse/parseIntegerOrDecimal.js +0 -123
- package/dist/parse/parseIntegerOrDecimal.js.map +0 -1
- package/dist/parse/parseItem.d.ts +0 -5
- package/dist/parse/parseItem.d.ts.map +0 -1
- package/dist/parse/parseItem.js +0 -25
- package/dist/parse/parseItem.js.map +0 -1
- package/dist/parse/parseItemOrInnerList.d.ts +0 -6
- package/dist/parse/parseItemOrInnerList.d.ts.map +0 -1
- package/dist/parse/parseItemOrInnerList.js +0 -22
- package/dist/parse/parseItemOrInnerList.js.map +0 -1
- package/dist/parse/parseKey.d.ts +0 -3
- package/dist/parse/parseKey.d.ts.map +0 -1
- package/dist/parse/parseKey.js +0 -40
- package/dist/parse/parseKey.js.map +0 -1
- package/dist/parse/parseList.d.ts +0 -5
- package/dist/parse/parseList.d.ts.map +0 -1
- package/dist/parse/parseList.js +0 -51
- package/dist/parse/parseList.js.map +0 -1
- package/dist/parse/parseParameters.d.ts +0 -5
- package/dist/parse/parseParameters.d.ts.map +0 -1
- package/dist/parse/parseParameters.js +0 -68
- package/dist/parse/parseParameters.js.map +0 -1
- package/dist/parse/parseString.d.ts +0 -3
- package/dist/parse/parseString.d.ts.map +0 -1
- package/dist/parse/parseString.js +0 -73
- package/dist/parse/parseString.js.map +0 -1
- package/dist/parse/parseToken.d.ts +0 -5
- package/dist/parse/parseToken.d.ts.map +0 -1
- package/dist/parse/parseToken.js +0 -35
- package/dist/parse/parseToken.js.map +0 -1
- package/dist/serialize/index.d.ts +0 -21
- package/dist/serialize/index.d.ts.map +0 -1
- package/dist/serialize/index.js +0 -21
- package/dist/serialize/index.js.map +0 -1
- package/dist/serialize/serializeBareItem.d.ts +0 -2
- package/dist/serialize/serializeBareItem.d.ts.map +0 -1
- package/dist/serialize/serializeBareItem.js +0 -69
- package/dist/serialize/serializeBareItem.js.map +0 -1
- package/dist/serialize/serializeBoolean.d.ts +0 -2
- package/dist/serialize/serializeBoolean.d.ts.map +0 -1
- package/dist/serialize/serializeBoolean.js +0 -25
- package/dist/serialize/serializeBoolean.js.map +0 -1
- package/dist/serialize/serializeByteSequence.d.ts +0 -2
- package/dist/serialize/serializeByteSequence.d.ts.map +0 -1
- package/dist/serialize/serializeByteSequence.js +0 -34
- package/dist/serialize/serializeByteSequence.js.map +0 -1
- package/dist/serialize/serializeDate.d.ts +0 -2
- package/dist/serialize/serializeDate.d.ts.map +0 -1
- package/dist/serialize/serializeDate.js +0 -13
- package/dist/serialize/serializeDate.js.map +0 -1
- package/dist/serialize/serializeDecimal.d.ts +0 -2
- package/dist/serialize/serializeDecimal.d.ts.map +0 -1
- package/dist/serialize/serializeDecimal.js +0 -46
- package/dist/serialize/serializeDecimal.js.map +0 -1
- package/dist/serialize/serializeDict.d.ts +0 -3
- package/dist/serialize/serializeDict.d.ts.map +0 -1
- package/dist/serialize/serializeDict.js +0 -74
- package/dist/serialize/serializeDict.js.map +0 -1
- package/dist/serialize/serializeError.d.ts +0 -2
- package/dist/serialize/serializeError.d.ts.map +0 -1
- package/dist/serialize/serializeError.js +0 -5
- package/dist/serialize/serializeError.js.map +0 -1
- package/dist/serialize/serializeInnerList.d.ts +0 -3
- package/dist/serialize/serializeInnerList.d.ts.map +0 -1
- package/dist/serialize/serializeInnerList.js +0 -28
- package/dist/serialize/serializeInnerList.js.map +0 -1
- package/dist/serialize/serializeInteger.d.ts +0 -2
- package/dist/serialize/serializeInteger.d.ts.map +0 -1
- package/dist/serialize/serializeInteger.js +0 -28
- package/dist/serialize/serializeInteger.js.map +0 -1
- package/dist/serialize/serializeItem.d.ts +0 -4
- package/dist/serialize/serializeItem.d.ts.map +0 -1
- package/dist/serialize/serializeItem.js +0 -26
- package/dist/serialize/serializeItem.js.map +0 -1
- package/dist/serialize/serializeKey.d.ts +0 -2
- package/dist/serialize/serializeKey.d.ts.map +0 -1
- package/dist/serialize/serializeKey.js +0 -28
- package/dist/serialize/serializeKey.js.map +0 -1
- package/dist/serialize/serializeList.d.ts +0 -4
- package/dist/serialize/serializeList.d.ts.map +0 -1
- package/dist/serialize/serializeList.js +0 -48
- package/dist/serialize/serializeList.js.map +0 -1
- package/dist/serialize/serializeParams.d.ts +0 -2
- package/dist/serialize/serializeParams.d.ts.map +0 -1
- package/dist/serialize/serializeParams.js +0 -40
- package/dist/serialize/serializeParams.js.map +0 -1
- package/dist/serialize/serializeString.d.ts +0 -2
- package/dist/serialize/serializeString.d.ts.map +0 -1
- package/dist/serialize/serializeString.js +0 -34
- package/dist/serialize/serializeString.js.map +0 -1
- package/dist/serialize/serializeToken.d.ts +0 -4
- package/dist/serialize/serializeToken.d.ts.map +0 -1
- package/dist/serialize/serializeToken.js +0 -11
- package/dist/serialize/serializeToken.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/BARE_ITEM.d.ts +0 -2
- package/dist/utils/BARE_ITEM.d.ts.map +0 -1
- package/dist/utils/BARE_ITEM.js +0 -2
- package/dist/utils/BARE_ITEM.js.map +0 -1
- package/dist/utils/BOOLEAN.d.ts +0 -2
- package/dist/utils/BOOLEAN.d.ts.map +0 -1
- package/dist/utils/BOOLEAN.js +0 -2
- package/dist/utils/BOOLEAN.js.map +0 -1
- package/dist/utils/BYTES.d.ts +0 -2
- package/dist/utils/BYTES.d.ts.map +0 -1
- package/dist/utils/BYTES.js +0 -2
- package/dist/utils/BYTES.js.map +0 -1
- package/dist/utils/DATE.d.ts +0 -2
- package/dist/utils/DATE.d.ts.map +0 -1
- package/dist/utils/DATE.js +0 -2
- package/dist/utils/DATE.js.map +0 -1
- package/dist/utils/DECIMAL.d.ts +0 -2
- package/dist/utils/DECIMAL.d.ts.map +0 -1
- package/dist/utils/DECIMAL.js +0 -2
- package/dist/utils/DECIMAL.js.map +0 -1
- package/dist/utils/DICT.d.ts +0 -2
- package/dist/utils/DICT.d.ts.map +0 -1
- package/dist/utils/DICT.js +0 -2
- package/dist/utils/DICT.js.map +0 -1
- package/dist/utils/INNER.d.ts +0 -2
- package/dist/utils/INNER.d.ts.map +0 -1
- package/dist/utils/INNER.js +0 -2
- package/dist/utils/INNER.js.map +0 -1
- package/dist/utils/INTEGER.d.ts +0 -2
- package/dist/utils/INTEGER.d.ts.map +0 -1
- package/dist/utils/INTEGER.js +0 -2
- package/dist/utils/INTEGER.js.map +0 -1
- package/dist/utils/INTEGER_DECIMAL.d.ts +0 -2
- package/dist/utils/INTEGER_DECIMAL.d.ts.map +0 -1
- package/dist/utils/INTEGER_DECIMAL.js +0 -4
- package/dist/utils/INTEGER_DECIMAL.js.map +0 -1
- package/dist/utils/ITEM.d.ts +0 -2
- package/dist/utils/ITEM.d.ts.map +0 -1
- package/dist/utils/ITEM.js +0 -2
- package/dist/utils/ITEM.js.map +0 -1
- package/dist/utils/KEY.d.ts +0 -2
- package/dist/utils/KEY.d.ts.map +0 -1
- package/dist/utils/KEY.js +0 -2
- package/dist/utils/KEY.js.map +0 -1
- package/dist/utils/LIST.d.ts +0 -2
- package/dist/utils/LIST.d.ts.map +0 -1
- package/dist/utils/LIST.js +0 -2
- package/dist/utils/LIST.js.map +0 -1
- package/dist/utils/STRING.d.ts +0 -2
- package/dist/utils/STRING.d.ts.map +0 -1
- package/dist/utils/STRING.js +0 -2
- package/dist/utils/STRING.js.map +0 -1
- package/dist/utils/STRING_REGEX.d.ts +0 -2
- package/dist/utils/STRING_REGEX.d.ts.map +0 -1
- package/dist/utils/STRING_REGEX.js +0 -2
- package/dist/utils/STRING_REGEX.js.map +0 -1
- package/dist/utils/TOKEN.d.ts +0 -2
- package/dist/utils/TOKEN.d.ts.map +0 -1
- package/dist/utils/TOKEN.js +0 -2
- package/dist/utils/TOKEN.js.map +0 -1
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -10
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/isInvalidInt.d.ts +0 -2
- package/dist/utils/isInvalidInt.d.ts.map +0 -1
- package/dist/utils/isInvalidInt.js +0 -4
- package/dist/utils/isInvalidInt.js.map +0 -1
- package/dist/utils/symbolToStr.d.ts +0 -13
- package/dist/utils/symbolToStr.d.ts.map +0 -1
- package/dist/utils/symbolToStr.js +0 -14
- package/dist/utils/symbolToStr.js.map +0 -1
- package/dist/utils/throwError.d.ts +0 -2
- package/dist/utils/throwError.d.ts.map +0 -1
- package/dist/utils/throwError.js +0 -19
- package/dist/utils/throwError.js.map +0 -1
package/dist/decodeSfItem.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { parseError } from './parse/parseError.js';
|
|
2
|
-
import { parseItem } from './parse/parseItem.js';
|
|
3
|
-
import { ITEM } from './utils/ITEM.js';
|
|
4
|
-
// 4.2. Parsing Structured Fields
|
|
5
|
-
//
|
|
6
|
-
// 1. Convert input_bytes into an ASCII string input_string; if
|
|
7
|
-
// conversion fails, fail parsing.
|
|
8
|
-
//
|
|
9
|
-
// 2. Discard any leading SP characters from input_string.
|
|
10
|
-
//
|
|
11
|
-
// 3. If field_type is "list", let output be the result of running
|
|
12
|
-
// Parsing a List (Section 4.2.1) with input_string.
|
|
13
|
-
//
|
|
14
|
-
// 4. If field_type is "dictionary", let output be the result of
|
|
15
|
-
// running Parsing a Dictionary (Section 4.2.2) with input_string.
|
|
16
|
-
//
|
|
17
|
-
// 5. If field_type is "item", let output be the result of running
|
|
18
|
-
// Parsing an Item (Section 4.2.3) with input_string.
|
|
19
|
-
//
|
|
20
|
-
// 6. Discard any leading SP characters from input_string.
|
|
21
|
-
//
|
|
22
|
-
// 7. If input_string is not empty, fail parsing.
|
|
23
|
-
//
|
|
24
|
-
// 8. Otherwise, return output.
|
|
25
|
-
/**
|
|
26
|
-
* Decode a structured field string into a structured field item
|
|
27
|
-
*
|
|
28
|
-
* @param input - The structured field string to decode
|
|
29
|
-
* @returns The structured field item
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @beta
|
|
33
|
-
*/
|
|
34
|
-
export function decodeSfItem(input, options) {
|
|
35
|
-
try {
|
|
36
|
-
const { src, value } = parseItem(input.trim(), options);
|
|
37
|
-
if (src !== '') {
|
|
38
|
-
throw parseError(src, ITEM);
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
catch (cause) {
|
|
43
|
-
throw parseError(input, ITEM, cause);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=decodeSfItem.js.map
|
package/dist/decodeSfItem.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeSfItem.js","sourceRoot":"","sources":["../src/decodeSfItem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,kCAAkC;AAClC,EAAE;AACF,gEAAgE;AAChE,sCAAsC;AACtC,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,mEAAmE;AACnE,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,sEAAsE;AACtE,EAAE;AACF,mEAAmE;AACnE,yDAAyD;AACzD,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,gCAAgC;AAChC;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAyB;IACpE,IAAI,CAAC;QACJ,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YAChB,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACd,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC","sourcesContent":["import type { SfDecodeOptions } from './SfDecodeOptions.js';\nimport type { SfItem } from './SfItem.js';\nimport { parseError } from './parse/parseError.js';\nimport { parseItem } from './parse/parseItem.js';\nimport { ITEM } from './utils/ITEM.js';\n\n// 4.2. Parsing Structured Fields\n//\n// 1. Convert input_bytes into an ASCII string input_string; if\n// conversion fails, fail parsing.\n//\n// 2. Discard any leading SP characters from input_string.\n//\n// 3. If field_type is \"list\", let output be the result of running\n// Parsing a List (Section 4.2.1) with input_string.\n//\n// 4. If field_type is \"dictionary\", let output be the result of\n// running Parsing a Dictionary (Section 4.2.2) with input_string.\n//\n// 5. If field_type is \"item\", let output be the result of running\n// Parsing an Item (Section 4.2.3) with input_string.\n//\n// 6. Discard any leading SP characters from input_string.\n//\n// 7. If input_string is not empty, fail parsing.\n//\n// 8. Otherwise, return output.\n/**\n * Decode a structured field string into a structured field item\n *\n * @param input - The structured field string to decode\n * @returns The structured field item\n *\n *\n * @beta\n */\nexport function decodeSfItem(input: string, options?: SfDecodeOptions): SfItem {\n\ttry {\n\t\tconst { src, value } = parseItem(input.trim(), options);\n\t\tif (src !== '') {\n\t\t\tthrow parseError(src, ITEM);\n\t\t}\n\n\t\treturn value;\n\t}\n\tcatch (cause) {\n\t\tthrow parseError(input, ITEM, cause);\n\t}\n}\n"]}
|
package/dist/decodeSfList.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { SfDecodeOptions } from './SfDecodeOptions.js';
|
|
2
|
-
import type { SfMember } from './SfMember.js';
|
|
3
|
-
/**
|
|
4
|
-
* Decode a structured field string into a structured field list
|
|
5
|
-
*
|
|
6
|
-
* @param input - The structured field string to decode
|
|
7
|
-
* @returns The structured field list
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @beta
|
|
11
|
-
*/
|
|
12
|
-
export declare function decodeSfList(input: string, options?: SfDecodeOptions): SfMember[];
|
|
13
|
-
//# sourceMappingURL=decodeSfList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeSfList.d.ts","sourceRoot":"","sources":["../src/decodeSfList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9C;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,EAAE,CAWjF"}
|
package/dist/decodeSfList.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { parseError } from './parse/parseError.js';
|
|
2
|
-
import { parseList } from './parse/parseList.js';
|
|
3
|
-
import { LIST } from './utils/LIST.js';
|
|
4
|
-
/**
|
|
5
|
-
* Decode a structured field string into a structured field list
|
|
6
|
-
*
|
|
7
|
-
* @param input - The structured field string to decode
|
|
8
|
-
* @returns The structured field list
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
12
|
-
*/
|
|
13
|
-
export function decodeSfList(input, options) {
|
|
14
|
-
try {
|
|
15
|
-
const { src, value } = parseList(input.trim(), options);
|
|
16
|
-
if (src !== '') {
|
|
17
|
-
throw parseError(src, LIST);
|
|
18
|
-
}
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
catch (cause) {
|
|
22
|
-
throw parseError(input, LIST, cause);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=decodeSfList.js.map
|
package/dist/decodeSfList.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeSfList.js","sourceRoot":"","sources":["../src/decodeSfList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAyB;IACpE,IAAI,CAAC;QACJ,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YAChB,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACd,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC","sourcesContent":["import type { SfDecodeOptions } from './SfDecodeOptions.js';\nimport type { SfMember } from './SfMember.js';\nimport { parseError } from './parse/parseError.js';\nimport { parseList } from './parse/parseList.js';\nimport { LIST } from './utils/LIST.js';\n\n/**\n * Decode a structured field string into a structured field list\n *\n * @param input - The structured field string to decode\n * @returns The structured field list\n *\n *\n * @beta\n */\nexport function decodeSfList(input: string, options?: SfDecodeOptions): SfMember[] {\n\ttry {\n\t\tconst { src, value } = parseList(input.trim(), options);\n\t\tif (src !== '') {\n\t\t\tthrow parseError(src, LIST);\n\t\t}\n\t\treturn value;\n\t}\n\tcatch (cause) {\n\t\tthrow parseError(input, LIST, cause);\n\t}\n}\n"]}
|
package/dist/encodeSfDict.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SfEncodeOptions } from './SfEncodeOptions.js';
|
|
2
|
-
/**
|
|
3
|
-
* Encode an object into a structured field dictionary
|
|
4
|
-
*
|
|
5
|
-
* @param value - The structured field dictionary to encode
|
|
6
|
-
* @param options - Encoding options
|
|
7
|
-
*
|
|
8
|
-
* @returns The structured field string
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
12
|
-
*/
|
|
13
|
-
export declare function encodeSfDict(value: Record<string, any> | Map<string, any>, options?: SfEncodeOptions): string;
|
|
14
|
-
//# sourceMappingURL=encodeSfDict.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfDict.d.ts","sourceRoot":"","sources":["../src/encodeSfDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,MAAM,CAE7G"}
|
package/dist/encodeSfDict.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { serializeDict } from './serialize/serializeDict.js';
|
|
2
|
-
/**
|
|
3
|
-
* Encode an object into a structured field dictionary
|
|
4
|
-
*
|
|
5
|
-
* @param value - The structured field dictionary to encode
|
|
6
|
-
* @param options - Encoding options
|
|
7
|
-
*
|
|
8
|
-
* @returns The structured field string
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
12
|
-
*/
|
|
13
|
-
export function encodeSfDict(value, options) {
|
|
14
|
-
return serializeDict(value, options);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=encodeSfDict.js.map
|
package/dist/encodeSfDict.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfDict.js","sourceRoot":"","sources":["../src/encodeSfDict.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,KAA6C,EAAE,OAAyB;IACpG,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import type { SfEncodeOptions } from './SfEncodeOptions.js';\nimport { serializeDict } from './serialize/serializeDict.js';\n\n/**\n * Encode an object into a structured field dictionary\n *\n * @param value - The structured field dictionary to encode\n * @param options - Encoding options\n *\n * @returns The structured field string\n *\n *\n * @beta\n */\nexport function encodeSfDict(value: Record<string, any> | Map<string, any>, options?: SfEncodeOptions): string {\n\treturn serializeDict(value, options);\n}\n"]}
|
package/dist/encodeSfItem.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { SfBareItem } from './SfBareItem.js';
|
|
2
|
-
import { SfItem } from './SfItem.js';
|
|
3
|
-
import type { SfParameters } from './SfParameters.js';
|
|
4
|
-
/**
|
|
5
|
-
* Encode a structured field item to a string
|
|
6
|
-
*
|
|
7
|
-
* @param value - The structured field item to encode
|
|
8
|
-
*
|
|
9
|
-
* @returns The structured field string
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @beta
|
|
13
|
-
*/
|
|
14
|
-
export declare function encodeSfItem(value: SfItem): string;
|
|
15
|
-
/**
|
|
16
|
-
* Encode a structured field value to a string with optional parameters.
|
|
17
|
-
*
|
|
18
|
-
* @param value - The structured field value to encode
|
|
19
|
-
* @param params - The structured field parameters
|
|
20
|
-
*
|
|
21
|
-
* @returns The structured field string
|
|
22
|
-
*
|
|
23
|
-
* @beta
|
|
24
|
-
*/
|
|
25
|
-
export declare function encodeSfItem(value: SfBareItem, params?: SfParameters): string;
|
|
26
|
-
//# sourceMappingURL=encodeSfItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfItem.d.ts","sourceRoot":"","sources":["../src/encodeSfItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC"}
|
package/dist/encodeSfItem.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SfItem } from './SfItem.js';
|
|
2
|
-
import { serializeItem } from './serialize/serializeItem.js';
|
|
3
|
-
export function encodeSfItem(value, params) {
|
|
4
|
-
if (!(value instanceof SfItem)) {
|
|
5
|
-
value = new SfItem(value, params);
|
|
6
|
-
}
|
|
7
|
-
return serializeItem(value);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=encodeSfItem.js.map
|
package/dist/encodeSfItem.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfItem.js","sourceRoot":"","sources":["../src/encodeSfItem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA0B7D,MAAM,UAAU,YAAY,CAAC,KAA0B,EAAE,MAAqB;IAC7E,IAAI,CAAC,CAAC,KAAK,YAAY,MAAM,CAAC,EAAE,CAAC;QAChC,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import type { SfBareItem } from './SfBareItem.js';\nimport { SfItem } from './SfItem.js';\nimport type { SfParameters } from './SfParameters.js';\nimport { serializeItem } from './serialize/serializeItem.js';\n\n/**\n * Encode a structured field item to a string\n *\n * @param value - The structured field item to encode\n *\n * @returns The structured field string\n *\n *\n * @beta\n */\nexport function encodeSfItem(value: SfItem): string;\n\n/**\n * Encode a structured field value to a string with optional parameters.\n *\n * @param value - The structured field value to encode\n * @param params - The structured field parameters\n *\n * @returns The structured field string\n *\n * @beta\n */\nexport function encodeSfItem(value: SfBareItem, params?: SfParameters): string;\n\nexport function encodeSfItem(value: SfItem | SfBareItem, params?: SfParameters) {\n\tif (!(value instanceof SfItem)) {\n\t\tvalue = new SfItem(value, params);\n\t}\n\n\treturn serializeItem(value);\n}\n"]}
|
package/dist/encodeSfList.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { SfEncodeOptions } from './SfEncodeOptions.js';
|
|
2
|
-
import type { SfMember } from './SfMember.js';
|
|
3
|
-
/**
|
|
4
|
-
* Encode a list into a structured field dictionary
|
|
5
|
-
*
|
|
6
|
-
* @param value - The structured field list to encode
|
|
7
|
-
* @param options - Encoding options
|
|
8
|
-
*
|
|
9
|
-
* @returns The structured field string
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @beta
|
|
13
|
-
*/
|
|
14
|
-
export declare function encodeSfList(value: SfMember[], options?: SfEncodeOptions): string;
|
|
15
|
-
//# sourceMappingURL=encodeSfList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfList.d.ts","sourceRoot":"","sources":["../src/encodeSfList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,MAAM,CAEjF"}
|
package/dist/encodeSfList.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { serializeList } from './serialize/serializeList.js';
|
|
2
|
-
/**
|
|
3
|
-
* Encode a list into a structured field dictionary
|
|
4
|
-
*
|
|
5
|
-
* @param value - The structured field list to encode
|
|
6
|
-
* @param options - Encoding options
|
|
7
|
-
*
|
|
8
|
-
* @returns The structured field string
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
12
|
-
*/
|
|
13
|
-
export function encodeSfList(value, options) {
|
|
14
|
-
return serializeList(value, options);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=encodeSfList.js.map
|
package/dist/encodeSfList.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSfList.js","sourceRoot":"","sources":["../src/encodeSfList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB,EAAE,OAAyB;IACxE,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import type { SfEncodeOptions } from './SfEncodeOptions.js';\nimport type { SfMember } from './SfMember.js';\nimport { serializeList } from './serialize/serializeList.js';\n\n/**\n * Encode a list into a structured field dictionary\n *\n * @param value - The structured field list to encode\n * @param options - Encoding options\n *\n * @returns The structured field string\n *\n *\n * @beta\n */\nexport function encodeSfList(value: SfMember[], options?: SfEncodeOptions): string {\n\treturn serializeList(value, options);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedValue.d.ts","sourceRoot":"","sources":["../../src/parse/ParsedValue.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAEpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedValue.js","sourceRoot":"","sources":["../../src/parse/ParsedValue.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,WAAW,CAAI,KAAQ,EAAE,GAAW;IACnD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC","sourcesContent":["export type ParsedValue<T> = {\n\tvalue: T;\n\tsrc: string;\n};\n\nexport function parsedValue<T>(value: T, src: string): ParsedValue<T> {\n\treturn { value, src };\n}\n"]}
|
package/dist/parse/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsing utilities for structured fields.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
export * from './parseBareItem.js';
|
|
7
|
-
export * from './parseBoolean.js';
|
|
8
|
-
export * from './parseByteSequence.js';
|
|
9
|
-
export * from './parseDate.js';
|
|
10
|
-
export * from './parseDict.js';
|
|
11
|
-
export type { ParsedValue } from './ParsedValue.js';
|
|
12
|
-
export * from './parseError.js';
|
|
13
|
-
export * from './parseInnerList.js';
|
|
14
|
-
export * from './parseIntegerOrDecimal.js';
|
|
15
|
-
export * from './parseItem.js';
|
|
16
|
-
export * from './parseItemOrInnerList.js';
|
|
17
|
-
export * from './parseKey.js';
|
|
18
|
-
export * from './parseList.js';
|
|
19
|
-
export * from './parseParameters.js';
|
|
20
|
-
export * from './parseString.js';
|
|
21
|
-
export * from './parseToken.js';
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
package/dist/parse/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsing utilities for structured fields.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
export * from './parseBareItem.js';
|
|
7
|
-
export * from './parseBoolean.js';
|
|
8
|
-
export * from './parseByteSequence.js';
|
|
9
|
-
export * from './parseDate.js';
|
|
10
|
-
export * from './parseDict.js';
|
|
11
|
-
export * from './parseError.js';
|
|
12
|
-
export * from './parseInnerList.js';
|
|
13
|
-
export * from './parseIntegerOrDecimal.js';
|
|
14
|
-
export * from './parseItem.js';
|
|
15
|
-
export * from './parseItemOrInnerList.js';
|
|
16
|
-
export * from './parseKey.js';
|
|
17
|
-
export * from './parseList.js';
|
|
18
|
-
export * from './parseParameters.js';
|
|
19
|
-
export * from './parseString.js';
|
|
20
|
-
export * from './parseToken.js';
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/dist/parse/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC","sourcesContent":["/**\n * Parsing utilities for structured fields.\n *\n * @packageDocumentation\n */\nexport * from './parseBareItem.js';\nexport * from './parseBoolean.js';\nexport * from './parseByteSequence.js';\nexport * from './parseDate.js';\nexport * from './parseDict.js';\nexport type { ParsedValue } from './ParsedValue.js';\nexport * from './parseError.js';\nexport * from './parseInnerList.js';\nexport * from './parseIntegerOrDecimal.js';\nexport * from './parseItem.js';\nexport * from './parseItemOrInnerList.js';\nexport * from './parseKey.js';\nexport * from './parseList.js';\nexport * from './parseParameters.js';\nexport * from './parseString.js';\nexport * from './parseToken.js';\n\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SfBareItem } from '../SfBareItem.js';
|
|
2
|
-
import type { SfDecodeOptions } from '../SfDecodeOptions.js';
|
|
3
|
-
import type { ParsedValue } from './ParsedValue.js';
|
|
4
|
-
export declare function parseBareItem(src: string, options?: SfDecodeOptions): ParsedValue<SfBareItem>;
|
|
5
|
-
//# sourceMappingURL=parseBareItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseBareItem.d.ts","sourceRoot":"","sources":["../../src/parse/parseBareItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqCpD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,CAqB7F"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { BARE_ITEM } from '../utils/BARE_ITEM.js';
|
|
2
|
-
import { parseBoolean } from './parseBoolean.js';
|
|
3
|
-
import { parseByteSequence } from './parseByteSequence.js';
|
|
4
|
-
import { parseDate } from './parseDate.js';
|
|
5
|
-
import { parseError } from './parseError.js';
|
|
6
|
-
import { parseIntegerOrDecimal } from './parseIntegerOrDecimal.js';
|
|
7
|
-
import { parseString } from './parseString.js';
|
|
8
|
-
import { parseToken } from './parseToken.js';
|
|
9
|
-
// 4.2.3.1. Parsing a Bare Item
|
|
10
|
-
//
|
|
11
|
-
// Given an ASCII string as input_string, return a bare Item.
|
|
12
|
-
// input_string is modified to remove the parsed value.
|
|
13
|
-
//
|
|
14
|
-
// 1. If the first character of input_string is a "-" or a DIGIT,
|
|
15
|
-
// return the result of running Parsing an Integer or Decimal
|
|
16
|
-
// (Section 4.2.4) with input_string.
|
|
17
|
-
//
|
|
18
|
-
// 2. If the first character of input_string is a DQUOTE, return the
|
|
19
|
-
// result of running Parsing a String (Section 4.2.5) with
|
|
20
|
-
// input_string.
|
|
21
|
-
//
|
|
22
|
-
// 3. If the first character of input_string is ":", return the result
|
|
23
|
-
// of running Parsing a Byte Sequence (Section 4.2.7) with
|
|
24
|
-
// input_string.
|
|
25
|
-
//
|
|
26
|
-
// 4. If the first character of input_string is "?", return the result
|
|
27
|
-
// of running Parsing a Boolean (Section 4.2.8) with input_string.
|
|
28
|
-
//
|
|
29
|
-
// 5. If the first character of input_string is an ALPHA or "*", return
|
|
30
|
-
// the result of running Parsing a Token (Section 4.2.6) with
|
|
31
|
-
// input_string.
|
|
32
|
-
//
|
|
33
|
-
// 6. If the first character of input_string is "@", return the result
|
|
34
|
-
// of running Parsing a Date (Section 4.2.9) with input_string.
|
|
35
|
-
//
|
|
36
|
-
// 7. Otherwise, the item type is unrecognized; fail parsing.
|
|
37
|
-
export function parseBareItem(src, options) {
|
|
38
|
-
const first = src[0];
|
|
39
|
-
if (first === `"`) {
|
|
40
|
-
return parseString(src);
|
|
41
|
-
}
|
|
42
|
-
if (/^[-0-9]/.test(first)) {
|
|
43
|
-
return parseIntegerOrDecimal(src);
|
|
44
|
-
}
|
|
45
|
-
if (first === `?`) {
|
|
46
|
-
return parseBoolean(src);
|
|
47
|
-
}
|
|
48
|
-
if (first === `:`) {
|
|
49
|
-
return parseByteSequence(src);
|
|
50
|
-
}
|
|
51
|
-
if (/^[a-zA-Z*]/.test(first)) {
|
|
52
|
-
return parseToken(src, options);
|
|
53
|
-
}
|
|
54
|
-
if (first === `@`) {
|
|
55
|
-
return parseDate(src);
|
|
56
|
-
}
|
|
57
|
-
throw parseError(src, BARE_ITEM);
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=parseBareItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseBareItem.js","sourceRoot":"","sources":["../../src/parse/parseBareItem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,gCAAgC;AAChC,EAAE;AACF,6DAA6D;AAC7D,uDAAuD;AACvD,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,yCAAyC;AACzC,EAAE;AACF,qEAAqE;AACrE,8DAA8D;AAC9D,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,8DAA8D;AAC9D,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,iEAAiE;AACjE,oBAAoB;AACpB,EAAE;AACF,uEAAuE;AACvE,mEAAmE;AACnE,EAAE;AACF,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,OAAyB;IACnE,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,MAAM,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import type { SfBareItem } from '../SfBareItem.js';\nimport type { SfDecodeOptions } from '../SfDecodeOptions.js';\nimport { BARE_ITEM } from '../utils/BARE_ITEM.js';\nimport type { ParsedValue } from './ParsedValue.js';\nimport { parseBoolean } from './parseBoolean.js';\nimport { parseByteSequence } from './parseByteSequence.js';\nimport { parseDate } from './parseDate.js';\nimport { parseError } from './parseError.js';\nimport { parseIntegerOrDecimal } from './parseIntegerOrDecimal.js';\nimport { parseString } from './parseString.js';\nimport { parseToken } from './parseToken.js';\n\n// 4.2.3.1. Parsing a Bare Item\n//\n// Given an ASCII string as input_string, return a bare Item.\n// input_string is modified to remove the parsed value.\n//\n// 1. If the first character of input_string is a \"-\" or a DIGIT,\n// return the result of running Parsing an Integer or Decimal\n// (Section 4.2.4) with input_string.\n//\n// 2. If the first character of input_string is a DQUOTE, return the\n// result of running Parsing a String (Section 4.2.5) with\n// input_string.\n//\n// 3. If the first character of input_string is \":\", return the result\n// of running Parsing a Byte Sequence (Section 4.2.7) with\n// input_string.\n//\n// 4. If the first character of input_string is \"?\", return the result\n// of running Parsing a Boolean (Section 4.2.8) with input_string.\n//\n// 5. If the first character of input_string is an ALPHA or \"*\", return\n// the result of running Parsing a Token (Section 4.2.6) with\n// input_string.\n//\n// 6. If the first character of input_string is \"@\", return the result\n// of running Parsing a Date (Section 4.2.9) with input_string.\n//\n// 7. Otherwise, the item type is unrecognized; fail parsing.\nexport function parseBareItem(src: string, options?: SfDecodeOptions): ParsedValue<SfBareItem> {\n\tconst first = src[0];\n\tif (first === `\"`) {\n\t\treturn parseString(src);\n\t}\n\tif (/^[-0-9]/.test(first)) {\n\t\treturn parseIntegerOrDecimal(src);\n\t}\n\tif (first === `?`) {\n\t\treturn parseBoolean(src);\n\t}\n\tif (first === `:`) {\n\t\treturn parseByteSequence(src);\n\t}\n\tif (/^[a-zA-Z*]/.test(first)) {\n\t\treturn parseToken(src, options);\n\t}\n\tif (first === `@`) {\n\t\treturn parseDate(src);\n\t}\n\tthrow parseError(src, BARE_ITEM);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseBoolean.d.ts","sourceRoot":"","sources":["../../src/parse/parseBoolean.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoBpD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAiB9D"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BOOLEAN } from '../utils/BOOLEAN.js';
|
|
2
|
-
import { parsedValue } from './ParsedValue.js';
|
|
3
|
-
import { parseError } from './parseError.js';
|
|
4
|
-
// 4.2.8. Parsing a Boolean
|
|
5
|
-
//
|
|
6
|
-
// Given an ASCII string as input_string, return a Boolean. input_string
|
|
7
|
-
// is modified to remove the parsed value.
|
|
8
|
-
//
|
|
9
|
-
// 1. If the first character of input_string is not "?", fail parsing.
|
|
10
|
-
//
|
|
11
|
-
// 2. Discard the first character of input_string.
|
|
12
|
-
//
|
|
13
|
-
// 3. If the first character of input_string matches "1", discard the
|
|
14
|
-
// first character, and return true.
|
|
15
|
-
//
|
|
16
|
-
// 4. If the first character of input_string matches "0", discard the
|
|
17
|
-
// first character, and return false.
|
|
18
|
-
//
|
|
19
|
-
// 5. No value has matched; fail parsing.
|
|
20
|
-
export function parseBoolean(src) {
|
|
21
|
-
let i = 0;
|
|
22
|
-
if (src[i] !== '?') {
|
|
23
|
-
throw parseError(src, BOOLEAN);
|
|
24
|
-
}
|
|
25
|
-
i++;
|
|
26
|
-
if (src[i] === '1') {
|
|
27
|
-
return parsedValue(true, src.substring(++i));
|
|
28
|
-
}
|
|
29
|
-
if (src[i] === '0') {
|
|
30
|
-
return parsedValue(false, src.substring(++i));
|
|
31
|
-
}
|
|
32
|
-
throw parseError(src, BOOLEAN);
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=parseBoolean.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseBoolean.js","sourceRoot":"","sources":["../../src/parse/parseBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,4BAA4B;AAC5B,EAAE;AACF,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,sEAAsE;AACtE,wCAAwC;AACxC,EAAE;AACF,sEAAsE;AACtE,yCAAyC;AACzC,EAAE;AACF,0CAA0C;AAC1C,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACpB,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,CAAC,EAAE,CAAC;IAEJ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { BOOLEAN } from '../utils/BOOLEAN.js';\nimport type { ParsedValue } from './ParsedValue.js';\nimport { parsedValue } from './ParsedValue.js';\nimport { parseError } from './parseError.js';\n\n// 4.2.8. Parsing a Boolean\n//\n// Given an ASCII string as input_string, return a Boolean. input_string\n// is modified to remove the parsed value.\n//\n// 1. If the first character of input_string is not \"?\", fail parsing.\n//\n// 2. Discard the first character of input_string.\n//\n// 3. If the first character of input_string matches \"1\", discard the\n// first character, and return true.\n//\n// 4. If the first character of input_string matches \"0\", discard the\n// first character, and return false.\n//\n// 5. No value has matched; fail parsing.\nexport function parseBoolean(src: string): ParsedValue<boolean> {\n\tlet i = 0;\n\tif (src[i] !== '?') {\n\t\tthrow parseError(src, BOOLEAN);\n\t}\n\n\ti++;\n\n\tif (src[i] === '1') {\n\t\treturn parsedValue(true, src.substring(++i));\n\t}\n\n\tif (src[i] === '0') {\n\t\treturn parsedValue(false, src.substring(++i));\n\t}\n\n\tthrow parseError(src, BOOLEAN);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseByteSequence.d.ts","sourceRoot":"","sources":["../../src/parse/parseByteSequence.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA4CpD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,UAAU,CAAC,CAmBtE"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { decodeBase64 } from '@svta/cml-utils/decodeBase64.js';
|
|
2
|
-
import { BYTES } from '../utils/BYTES.js';
|
|
3
|
-
import { parsedValue } from './ParsedValue.js';
|
|
4
|
-
import { parseError } from './parseError.js';
|
|
5
|
-
// 4.2.7. Parsing a Byte Sequence
|
|
6
|
-
//
|
|
7
|
-
// Given an ASCII string as input_string, return a Byte Sequence.
|
|
8
|
-
// input_string is modified to remove the parsed value.
|
|
9
|
-
//
|
|
10
|
-
// 1. If the first character of input_string is not ":", fail parsing.
|
|
11
|
-
//
|
|
12
|
-
// 2. Discard the first character of input_string.
|
|
13
|
-
//
|
|
14
|
-
// 3. If there is not a ":" character before the end of input_string,
|
|
15
|
-
// fail parsing.
|
|
16
|
-
//
|
|
17
|
-
// 4. Let b64_content be the result of consuming content of
|
|
18
|
-
// input_string up to but not including the first instance of the
|
|
19
|
-
// character ":".
|
|
20
|
-
//
|
|
21
|
-
// 5. Consume the ":" character at the beginning of input_string.
|
|
22
|
-
//
|
|
23
|
-
// 6. If b64_content contains a character not included in ALPHA, DIGIT,
|
|
24
|
-
// "+", "/" and "=", fail parsing.
|
|
25
|
-
//
|
|
26
|
-
// 7. Let binary_content be the result of Base 64 Decoding [RFC4648]
|
|
27
|
-
// b64_content, synthesizing padding if necessary (note the
|
|
28
|
-
// requirements about recipient behavior below).
|
|
29
|
-
//
|
|
30
|
-
// 8. Return binary_content.
|
|
31
|
-
//
|
|
32
|
-
// Because some implementations of base64 do not allow rejection of
|
|
33
|
-
// encoded data that is not properly "=" padded (see [RFC4648],
|
|
34
|
-
// Section 3.2), parsers SHOULD NOT fail when "=" padding is not
|
|
35
|
-
// present, unless they cannot be configured to do so.
|
|
36
|
-
//
|
|
37
|
-
// Because some implementations of base64 do not allow rejection of
|
|
38
|
-
// encoded data that has non-zero pad bits (see [RFC4648], Section 3.5),
|
|
39
|
-
// parsers SHOULD NOT fail when non-zero pad bits are present, unless
|
|
40
|
-
// they cannot be configured to do so.
|
|
41
|
-
//
|
|
42
|
-
// This specification does not relax the requirements in [RFC4648],
|
|
43
|
-
// Section 3.1 and 3.3; therefore, parsers MUST fail on characters
|
|
44
|
-
// outside the base64 alphabet, and on line feeds in encoded data.
|
|
45
|
-
export function parseByteSequence(src) {
|
|
46
|
-
if (src[0] !== ':') {
|
|
47
|
-
throw parseError(src, BYTES);
|
|
48
|
-
}
|
|
49
|
-
src = src.substring(1);
|
|
50
|
-
if (src.includes(':') === false) {
|
|
51
|
-
throw parseError(src, BYTES);
|
|
52
|
-
}
|
|
53
|
-
const re = /(^.*?)(:)/g;
|
|
54
|
-
const b64_content = re.exec(src)[1];
|
|
55
|
-
src = src.substring(re.lastIndex);
|
|
56
|
-
// pass b64_content char check step 6
|
|
57
|
-
return parsedValue(decodeBase64(b64_content), src);
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=parseByteSequence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseByteSequence.js","sourceRoot":"","sources":["../../src/parse/parseByteSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,kCAAkC;AAClC,EAAE;AACF,iEAAiE;AACjE,uDAAuD;AACvD,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,sEAAsE;AACtE,oBAAoB;AACpB,EAAE;AACF,4DAA4D;AAC5D,qEAAqE;AACrE,qBAAqB;AACrB,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,wEAAwE;AACxE,sCAAsC;AACtC,EAAE;AACF,qEAAqE;AACrE,+DAA+D;AAC/D,oDAAoD;AACpD,EAAE;AACF,6BAA6B;AAC7B,EAAE;AACF,mEAAmE;AACnE,+DAA+D;AAC/D,gEAAgE;AAChE,sDAAsD;AACtD,EAAE;AACF,mEAAmE;AACnE,wEAAwE;AACxE,qEAAqE;AACrE,sCAAsC;AACtC,EAAE;AACF,mEAAmE;AACnE,kEAAkE;AAClE,kEAAkE;AAClE,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC5C,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACpB,MAAM,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;QACjC,MAAM,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,EAAE,GAAG,YAAY,CAAC;IACxB,MAAM,WAAW,GAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAS,CAAC,CAAC,CAAC,CAAC;IAC7C,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAElC,qCAAqC;IACrC,OAAO,WAAW,CACjB,YAAY,CAAC,WAAW,CAAC,EACzB,GAAG,CACH,CAAC;AACH,CAAC","sourcesContent":["import { decodeBase64 } from '@svta/cml-utils/decodeBase64.js';\nimport { BYTES } from '../utils/BYTES.js';\nimport type { ParsedValue } from './ParsedValue.js';\nimport { parsedValue } from './ParsedValue.js';\nimport { parseError } from './parseError.js';\n\n// 4.2.7. Parsing a Byte Sequence\n//\n// Given an ASCII string as input_string, return a Byte Sequence.\n// input_string is modified to remove the parsed value.\n//\n// 1. If the first character of input_string is not \":\", fail parsing.\n//\n// 2. Discard the first character of input_string.\n//\n// 3. If there is not a \":\" character before the end of input_string,\n// fail parsing.\n//\n// 4. Let b64_content be the result of consuming content of\n// input_string up to but not including the first instance of the\n// character \":\".\n//\n// 5. Consume the \":\" character at the beginning of input_string.\n//\n// 6. If b64_content contains a character not included in ALPHA, DIGIT,\n// \"+\", \"/\" and \"=\", fail parsing.\n//\n// 7. Let binary_content be the result of Base 64 Decoding [RFC4648]\n// b64_content, synthesizing padding if necessary (note the\n// requirements about recipient behavior below).\n//\n// 8. Return binary_content.\n//\n// Because some implementations of base64 do not allow rejection of\n// encoded data that is not properly \"=\" padded (see [RFC4648],\n// Section 3.2), parsers SHOULD NOT fail when \"=\" padding is not\n// present, unless they cannot be configured to do so.\n//\n// Because some implementations of base64 do not allow rejection of\n// encoded data that has non-zero pad bits (see [RFC4648], Section 3.5),\n// parsers SHOULD NOT fail when non-zero pad bits are present, unless\n// they cannot be configured to do so.\n//\n// This specification does not relax the requirements in [RFC4648],\n// Section 3.1 and 3.3; therefore, parsers MUST fail on characters\n// outside the base64 alphabet, and on line feeds in encoded data.\nexport function parseByteSequence(src: string): ParsedValue<Uint8Array> {\n\tif (src[0] !== ':') {\n\t\tthrow parseError(src, BYTES);\n\t}\n\n\tsrc = src.substring(1);\n\tif (src.includes(':') === false) {\n\t\tthrow parseError(src, BYTES);\n\t}\n\n\tconst re = /(^.*?)(:)/g;\n\tconst b64_content = (re.exec(src) as any)[1];\n\tsrc = src.substring(re.lastIndex);\n\n\t// pass b64_content char check step 6\n\treturn parsedValue(\n\t\tdecodeBase64(b64_content),\n\t\tsrc,\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseDate.d.ts","sourceRoot":"","sources":["../../src/parse/parseDate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoBpD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAiBxD"}
|
package/dist/parse/parseDate.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { DATE } from '../utils/DATE.js';
|
|
2
|
-
import { parsedValue } from './ParsedValue.js';
|
|
3
|
-
import { parseError } from './parseError.js';
|
|
4
|
-
import { parseIntegerOrDecimal } from './parseIntegerOrDecimal.js';
|
|
5
|
-
// 4.2.9. Parsing a Date
|
|
6
|
-
//
|
|
7
|
-
// Given an ASCII string as input_string, return a Date. input_string is
|
|
8
|
-
// modified to remove the parsed value.
|
|
9
|
-
//
|
|
10
|
-
// 1. If the first character of input_string is not "@", fail parsing.
|
|
11
|
-
//
|
|
12
|
-
// 2. Discard the first character of input_string.
|
|
13
|
-
//
|
|
14
|
-
// 3. Let output_date be the result of running Parsing an Integer or
|
|
15
|
-
// Decimal (Section 4.2.4) with input_string.
|
|
16
|
-
//
|
|
17
|
-
// 4. If output_date is a Decimal, fail parsing.
|
|
18
|
-
//
|
|
19
|
-
// 5. Return output_date.
|
|
20
|
-
export function parseDate(src) {
|
|
21
|
-
let i = 0;
|
|
22
|
-
if (src[i] !== '@') {
|
|
23
|
-
throw parseError(src, DATE);
|
|
24
|
-
}
|
|
25
|
-
i++;
|
|
26
|
-
const date = parseIntegerOrDecimal(src.substring(i));
|
|
27
|
-
if (Number.isInteger(date.value) === false) {
|
|
28
|
-
throw parseError(src, DATE);
|
|
29
|
-
}
|
|
30
|
-
return parsedValue(new Date(date.value * 1000), date.src);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=parseDate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseDate.js","sourceRoot":"","sources":["../../src/parse/parseDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,yBAAyB;AACzB,EAAE;AACF,wEAAwE;AACxE,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,qEAAqE;AACrE,iDAAiD;AACjD,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,0BAA0B;AAC1B,MAAM,UAAU,SAAS,CAAC,GAAW;IACpC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACpB,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,CAAC,EAAE,CAAC;IACJ,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;QAC5C,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,WAAW,CACjB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAC3B,IAAI,CAAC,GAAG,CACR,CAAC;AACH,CAAC","sourcesContent":["import { DATE } from '../utils/DATE.js';\nimport type { ParsedValue } from './ParsedValue.js';\nimport { parsedValue } from './ParsedValue.js';\nimport { parseError } from './parseError.js';\nimport { parseIntegerOrDecimal } from './parseIntegerOrDecimal.js';\n\n// 4.2.9. Parsing a Date\n//\n// Given an ASCII string as input_string, return a Date. input_string is\n// modified to remove the parsed value.\n//\n// 1. If the first character of input_string is not \"@\", fail parsing.\n//\n// 2. Discard the first character of input_string.\n//\n// 3. Let output_date be the result of running Parsing an Integer or\n// Decimal (Section 4.2.4) with input_string.\n//\n// 4. If output_date is a Decimal, fail parsing.\n//\n// 5. Return output_date.\nexport function parseDate(src: string): ParsedValue<Date> {\n\tlet i = 0;\n\tif (src[i] !== '@') {\n\t\tthrow parseError(src, DATE);\n\t}\n\n\ti++;\n\tconst date = parseIntegerOrDecimal(src.substring(i));\n\n\tif (Number.isInteger(date.value) === false) {\n\t\tthrow parseError(src, DATE);\n\t}\n\n\treturn parsedValue(\n\t\tnew Date(date.value * 1000),\n\t\tdate.src,\n\t);\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SfDecodeOptions } from '../SfDecodeOptions.js';
|
|
2
|
-
import type { SfDictionary } from '../SfDictionary.js';
|
|
3
|
-
import type { ParsedValue } from './ParsedValue.js';
|
|
4
|
-
export declare function parseDict(src: string, options?: SfDecodeOptions): ParsedValue<SfDictionary>;
|
|
5
|
-
//# sourceMappingURL=parseDict.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseDict.d.ts","sourceRoot":"","sources":["../../src/parse/parseDict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAyDpD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,WAAW,CAAC,YAAY,CAAC,CAsC3F"}
|