@d1g1tal/media-type 4.1.0 → 5.0.1

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/src/media-type.js CHANGED
@@ -1,7 +1,6 @@
1
+ import { _type } from '@d1g1tal/chrysalis';
1
2
  import MediaTypeParameters from './media-type-parameters.js';
2
- import parse from './parser.js';
3
- import serialize from './serializer.js';
4
- import { asciiLowercase, solelyContainsHTTPTokenCodePoints } from './utils.js';
3
+ import MediaTypeParser from './media-type-parser.js';
5
4
 
6
5
  /**
7
6
  * Class used to parse media types.
@@ -24,33 +23,15 @@ export default class MediaType {
24
23
  * @param {Object} [parameters] Optional parameters.
25
24
  */
26
25
  constructor(mediaType, parameters = {}) {
27
- const { type, subtype, parameters: parsedParameters } = parse(mediaType);
28
- this.#type = type;
29
- this.#subtype = subtype;
30
- this.#parameters = new MediaTypeParameters([...parsedParameters, ...Object.entries(parameters).map(([name, value]) => [asciiLowercase(name), asciiLowercase(value)])]);
26
+ if (_type(parameters) != Object) { throw new TypeError('The parameters argument must be an object') }
27
+ ({ type: this.#type, subtype: this.#subtype, parameters: this.#parameters } = MediaTypeParser.parse(mediaType));
28
+ for (const [ name, value ] of Object.entries(parameters)) { this.#parameters.set(name, value) }
31
29
  }
32
30
 
33
- /**
34
- * Static factory method for parsing a media type.
35
- *
36
- * @param {string} string The media type to parse.
37
- * @returns {MediaType} The parsed {@link MediaType} object or null if the string could not be parsed.
38
- */
39
- static parse(string) {
40
- try {
41
- return new MediaType(string);
42
- } catch (e) {
43
- throw new Error(`Could not parse media type string '${string}'`);
44
- }
45
- }
31
+ static parse(mediaType) {
32
+ try { return new MediaType(mediaType) } catch(e) { /* ignore */ }
46
33
 
47
- /**
48
- * Gets the media type essence (type/subtype).
49
- *
50
- * @returns {string} The media type without any parameters
51
- */
52
- get essence() {
53
- return `${this.#type}/${this.#subtype}`;
34
+ return null;
54
35
  }
55
36
 
56
37
  /**
@@ -62,22 +43,6 @@ export default class MediaType {
62
43
  return this.#type;
63
44
  }
64
45
 
65
- /**
66
- * Sets the type.
67
- */
68
- set type(value) {
69
- value = asciiLowercase(String(value));
70
-
71
- if (value.length === 0) {
72
- throw new Error('Invalid type: must be a non-empty string');
73
- }
74
- if (!solelyContainsHTTPTokenCodePoints(value)) {
75
- throw new Error(`Invalid type ${value}: must contain only HTTP token code points`);
76
- }
77
-
78
- this.#type = value;
79
- }
80
-
81
46
  /**
82
47
  * Gets the subtype.
83
48
  *
@@ -88,19 +53,12 @@ export default class MediaType {
88
53
  }
89
54
 
90
55
  /**
91
- * Sets the subtype.
56
+ * Gets the media type essence (type/subtype).
57
+ *
58
+ * @returns {string} The media type without any parameters
92
59
  */
93
- set subtype(value) {
94
- value = asciiLowercase(String(value));
95
-
96
- if (value.length === 0) {
97
- throw new Error('Invalid subtype: must be a non-empty string');
98
- }
99
- if (!solelyContainsHTTPTokenCodePoints(value)) {
100
- throw new Error(`Invalid subtype ${value}: must contain only HTTP token code points`);
101
- }
102
-
103
- this.#subtype = value;
60
+ get essence() {
61
+ return `${this.#type}/${this.#subtype}`;
104
62
  }
105
63
 
106
64
  /**
@@ -113,71 +71,23 @@ export default class MediaType {
113
71
  }
114
72
 
115
73
  /**
116
- * Gets the serialized version of the media type.
117
- *
118
- * @returns {string} The serialized media type.
119
- */
120
- toString() {
121
- // The serialize function works on both 'media type records' (i.e. the results of parse) and on this class, since
122
- // this class's interface is identical.
123
- return serialize(this);
124
- }
125
-
126
- /**
127
- * Determines if this instance is a JavaScript media type.
128
- *
129
- * @param {Object} [options] Optional options.
130
- * @param {boolean} [options.prohibitParameters=false] The option to prohibit parameters when checking if the media type is JavaScript.
131
- * @returns {boolean} true if this instance represents a JavaScript media type, false otherwise.
132
- */
133
- isJavaScript({prohibitParameters = false} = {}) {
134
- switch (this.#type) {
135
- case 'text': {
136
- switch (this.#subtype) {
137
- case 'ecmascript':
138
- case 'javascript':
139
- case 'javascript1.0':
140
- case 'javascript1.1':
141
- case 'javascript1.2':
142
- case 'javascript1.3':
143
- case 'javascript1.4':
144
- case 'javascript1.5':
145
- case 'jscript':
146
- case 'livescript':
147
- case 'x-ecmascript':
148
- case 'x-javascript': return !prohibitParameters || this.#parameters.size === 0;
149
- default: return false;
150
- }
151
- }
152
- case 'application': {
153
- switch (this.#subtype) {
154
- case 'ecmascript':
155
- case 'javascript':
156
- case 'x-ecmascript':
157
- case 'x-javascript': return !prohibitParameters || this.#parameters.size === 0;
158
- default: return false;
159
- }
160
- }
161
- default: return false;
162
- }
163
- }
164
-
165
- /**
166
- * Determines if this instance is an XML media type.
74
+ * Checks if the media type matches the specified type.
167
75
  *
168
- * @returns {boolean} true if this instance represents an XML media type, false otherwise.
76
+ * @todo Fix string handling to parse the type and subtype from the string.
77
+ * @param {MediaType|string} mediaType The media type to check.
78
+ * @returns {boolean} true if the media type matches the specified type, false otherwise.
169
79
  */
170
- isXML() {
171
- return (this.#subtype === 'xml' && (this.#type === 'text' || this.#type === 'application')) || this.#subtype.endsWith('+xml');
80
+ matches(mediaType) {
81
+ return (this.#type === mediaType?.type && this.#subtype === mediaType?.subtype) || this.essence.includes(mediaType);
172
82
  }
173
83
 
174
84
  /**
175
- * Determines if this instance is an HTML media type.
85
+ * Gets the serialized version of the media type.
176
86
  *
177
- * @returns {boolean} true if this instance represents an HTML media type, false otherwise.
87
+ * @returns {string} The serialized media type.
178
88
  */
179
- isHTML() {
180
- return this.#subtype === 'html' && this.#type === 'text';
89
+ toString() {
90
+ return `${this.essence}${this.#parameters.toString()}`;
181
91
  }
182
92
 
183
93
  /**
package/src/utils.js CHANGED
@@ -1,94 +1,3 @@
1
- /** @module utils */
2
-
3
- const whitespaceCharacters = [' ', '\t', '\n', '\r'];
4
- const leadingWhitespace = /^[ \t\n\r]+/u;
5
- const trailingWhitespace = /[ \t\n\r]+$/u;
6
1
  const httpTokenCodePoints = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;
7
- const httpQuotedTokenCodePoints = /^[\t\u0020-\u007E\u0080-\u00FF]*$/u;
8
-
9
- /**
10
- * A function to remove any leading and trailing HTTP whitespace.
11
- *
12
- * @param {string} string The string to process.
13
- * @returns {string} The processed string.
14
- */
15
- const removeLeadingAndTrailingHTTPWhitespace = (string) => string.replace(leadingWhitespace, '').replace(trailingWhitespace, '');
16
-
17
- /**
18
- * A function to remove any trailing HTTP whitespace.
19
- *
20
- * @param {string} string The string to process.
21
- * @returns {string} The processed string.
22
- */
23
- const removeTrailingHTTPWhitespace = (string) => string.replace(trailingWhitespace, '');
24
-
25
- /**
26
- * Determines if the provided character is whitespace.
27
- *
28
- * @param {string} char The character to evaluate.
29
- * @returns {boolean} true if the character is whitespace, false otherwise.
30
- */
31
- const isHTTPWhitespaceChar = (char) => whitespaceCharacters.includes(char);
32
-
33
- /**
34
- * Determines if the provided string contains only HTTP token code points.
35
- *
36
- * @param {string} string The string to evaluate.
37
- * @returns {boolean} true if the string contains only HTTP token code points.
38
- */
39
- const solelyContainsHTTPTokenCodePoints = (string) => httpTokenCodePoints.test(string);
40
-
41
- /**
42
- * Determines if the provided string contains only quoted HTTP token code points.
43
- *
44
- * @param {string} string The string to evaluate.
45
- * @returns {boolean} true if the string contains only quoted HTTP token code points.
46
- */
47
- const solelyContainsHTTPQuotedStringTokenCodePoints = (string) => httpQuotedTokenCodePoints.test(string);
48
-
49
- /**
50
- * A function to lower case ASCII characters.
51
- * This implementation iterates over each element of the string, which is treated as an iterable.
52
- * The elements are destructured into [char, charCode] pairs, where char represents the character,
53
- * and charCode is assigned the character code using char.charCodeAt(0). If the charCode is not
54
- * provided, it falls back to the character code obtained from char.charCodeAt(0).
55
- *
56
- * @param {string} string The string to process.
57
- * @returns {string} The processed string with all ASCII characters lower cased.
58
- */
59
- const asciiLowercase = (string) => {
60
- let result = '';
61
- for (const [char, charCode = char.charCodeAt(0)] of string) {
62
- result += charCode >= 65 && charCode <= 90 ? String.fromCharCode(charCode + 32) : char;
63
- }
64
-
65
- return result;
66
- };
67
-
68
- /**
69
- * Collects all the HTTP quoted strings.
70
- * This variant only implements it with the extract-value flag set.
71
- *
72
- * @param {string} input The string to process.
73
- * @param {number} position The starting position.
74
- * @returns {Array<string|number>} An array that includes the resulting string and updated position.
75
- */
76
- const collectAnHTTPQuotedString = (input, position) => {
77
- let value = '';
78
-
79
- for (let length = input.length, char; ++position < length;) {
80
- char = input[position];
81
-
82
- if (char == '\\') {
83
- value += ++position < length ? input[position] : char;
84
- } else if (char == '"') {
85
- break;
86
- } else {
87
- value += char;
88
- }
89
- }
90
-
91
- return [value, position];
92
- };
93
2
 
94
- export { removeLeadingAndTrailingHTTPWhitespace, removeTrailingHTTPWhitespace, isHTTPWhitespaceChar, solelyContainsHTTPTokenCodePoints, solelyContainsHTTPQuotedStringTokenCodePoints, asciiLowercase, collectAnHTTPQuotedString };
3
+ export default httpTokenCodePoints;
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { default as MediaTypeParameters } from "./src/media-type-parameters.js";
2
- export { default as MediaType } from "./src/media-type.js";
3
- export { default as parse } from "./src/parser.js";
4
- export { default as serialize } from "./src/serializer.js";
5
- export * from "./src/utils.js";
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- export { default as MediaTypeParameters } from './src/media-type-parameters.js';
2
- export { default as MediaType } from './src/media-type.js';
3
- export { default as parse } from './src/parser.js';
4
- export { default as serialize } from './src/serializer.js';
5
- export * from './src/utils.js';
@@ -1,91 +0,0 @@
1
- /**
2
- * Class representing the parameters for a media type record.
3
- * This class has the equivalent surface API to a JavaScript {@link Map}.
4
- *
5
- * However, {@link MediaTypeParameters} methods will always interpret their arguments
6
- * as appropriate for media types, so parameter names will be lowercased,
7
- * and attempting to set invalid characters will throw an {@link Error}.
8
- *
9
- * @example charset=utf-8
10
- * @module MediaTypeParameters
11
- */
12
- export default class MediaTypeParameters {
13
- /**
14
- * Create a new MediaTypeParameters instance.
15
- *
16
- * @param {Map.<string, string>} map The map of parameters for a media type.
17
- */
18
- constructor(map: Map<string, string>);
19
- _map: Map<string, string>;
20
- /**
21
- * Gets the number of media type parameters.
22
- *
23
- * @returns {number} The number of media type parameters
24
- */
25
- get size(): number;
26
- /**
27
- * Gets the media type parameter value for the supplied name.
28
- *
29
- * @param {string} name The name of the media type parameter to retrieve.
30
- * @returns {string} The media type parameter value.
31
- */
32
- get(name: string): string;
33
- /**
34
- * Indicates whether the media type parameter with the specified name exists or not.
35
- *
36
- * @param {string} name The name of the media type parameter to check.
37
- * @returns {boolean} true if the media type parameter exists, false otherwise.
38
- */
39
- has(name: string): boolean;
40
- /**
41
- * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.
42
- * If an parameter with the same name already exists, the parameter will be updated.
43
- *
44
- * @param {string} name The name of the media type parameter to set.
45
- * @param {string} value The media type parameter value.
46
- * @returns {MediaTypeParameters} This instance.
47
- */
48
- set(name: string, value: string): MediaTypeParameters;
49
- /**
50
- * Clears all the media type parameters.
51
- */
52
- clear(): void;
53
- /**
54
- * Removes the media type parameter using the specified name.
55
- *
56
- * @param {string} name The name of the media type parameter to delete.
57
- * @returns {boolean} true if the parameter existed and has been removed, or false if the parameter does not exist.
58
- */
59
- delete(name: string): boolean;
60
- /**
61
- * Executes a provided function once per each name/value pair in the MediaTypeParameters, in insertion order.
62
- *
63
- * @param {function(string, string): void} callback The function called on each iteration.
64
- * @param {*} [thisArg] Optional object when binding 'this' to the callback.
65
- */
66
- forEach(callback: (arg0: string, arg1: string) => void, thisArg?: any): void;
67
- /**
68
- * Returns an iterable of parameter names.
69
- *
70
- * @returns {IterableIterator<string>} The {@link IterableIterator} of media type parameter names.
71
- */
72
- keys(): IterableIterator<string>;
73
- /**
74
- * Returns an iterable of parameter values.
75
- *
76
- * @returns {IterableIterator<string>} The {@link IterableIterator} of media type parameter values.
77
- */
78
- values(): IterableIterator<string>;
79
- /**
80
- * Returns an iterable of name, value pairs for every parameter entry in the media type parameters.
81
- *
82
- * @returns {IterableIterator<Array<Array<string>>>} The media type parameter entries.
83
- */
84
- entries(): IterableIterator<Array<Array<string>>>;
85
- /**
86
- * A method that returns the default iterator for the {@link MediaTypeParameters}. Called by the semantics of the for-of statement.
87
- *
88
- * @returns {Iterator<string, string, undefined>} The {@link Symbol.iterator} for the media type parameters.
89
- */
90
- [Symbol.iterator](): Iterator<string, string, undefined>;
91
- }
@@ -1,91 +0,0 @@
1
- /**
2
- * Class used to parse media types.
3
- *
4
- * @see https://mimesniff.spec.whatwg.org/#understanding-mime-types
5
- * @module MediaType
6
- */
7
- export default class MediaType {
8
- /**
9
- * Static factor method for parsing a media type.
10
- *
11
- * @param {string} string The media type to parse
12
- * @returns {MediaType} The parsed {@link MediaType} object
13
- */
14
- static parse(string: string): MediaType;
15
- /**
16
- * Create a new MediaType instance from a string representation.
17
- *
18
- * @param {string} string The media type to parse
19
- */
20
- constructor(string: string);
21
- _type: string;
22
- _subtype: string;
23
- _parameters: MediaTypeParameters;
24
- /**
25
- * Gets the media type essence (type/subtype).
26
- *
27
- * @returns {string} The media type without any parameters
28
- */
29
- get essence(): string;
30
- /**
31
- * Sets the type.
32
- */
33
- set type(arg: string);
34
- /**
35
- * Gets the type.
36
- *
37
- * @returns {string} The type.
38
- */
39
- get type(): string;
40
- /**
41
- * Sets the subtype.
42
- */
43
- set subtype(arg: string);
44
- /**
45
- * Gets the subtype.
46
- *
47
- * @returns {string} The subtype.
48
- */
49
- get subtype(): string;
50
- /**
51
- * Gets the parameters.
52
- *
53
- * @returns {MediaTypeParameters} The media type parameters.
54
- */
55
- get parameters(): MediaTypeParameters;
56
- /**
57
- * Gets the serialized version of the media type.
58
- *
59
- * @returns {string} The serialized media type.
60
- */
61
- toString(): string;
62
- /**
63
- * Determines if this instance is a JavaScript media type.
64
- *
65
- * @param {Object} [options] Optional options.
66
- * @param {boolean} [options.prohibitParameters=false] The option to prohibit parameters when checking if the media type is JavaScript.
67
- * @returns {boolean} true if this instance represents a JavaScript media type, false otherwise.
68
- */
69
- isJavaScript({ prohibitParameters }?: {
70
- prohibitParameters?: boolean;
71
- }): boolean;
72
- /**
73
- * Determines if this instance is an XML media type.
74
- *
75
- * @returns {boolean} true if this instance represents an XML media type, false otherwise.
76
- */
77
- isXML(): boolean;
78
- /**
79
- * Determines if this instance is an HTML media type.
80
- *
81
- * @returns {boolean} true if this instance represents an HTML media type, false otherwise.
82
- */
83
- isHTML(): boolean;
84
- /**
85
- * Gets the name of the class.
86
- *
87
- * @returns {string} The class name
88
- */
89
- get [Symbol.toStringTag](): string;
90
- }
91
- import MediaTypeParameters from "./media-type-parameters.js";
package/src/parser.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export default parse;
2
- /**
3
- * Function to parse a media type.
4
- *
5
- * @module parser
6
- * @param {string} input The media type to parse
7
- * @returns {{ type: string, subtype: string, parameters: Map<string, string> }} An object populated with the parsed media type properties and any parameters.
8
- */
9
- declare function parse(input: string): {
10
- type: string;
11
- subtype: string;
12
- parameters: Map<string, string>;
13
- };
package/src/parser.js DELETED
@@ -1,106 +0,0 @@
1
- import {
2
- asciiLowercase,
3
- collectAnHTTPQuotedString, isHTTPWhitespaceChar, removeLeadingAndTrailingHTTPWhitespace,
4
- removeTrailingHTTPWhitespace, solelyContainsHTTPQuotedStringTokenCodePoints, solelyContainsHTTPTokenCodePoints
5
- } from './utils.js';
6
-
7
- /**
8
- * Function to parse a media type.
9
- *
10
- * @module parser
11
- * @param {string} input The media type to parse
12
- * @returns {{ type: string, subtype: string, parameters: Map<string, string> }} An object populated with the parsed media type properties and any parameters.
13
- */
14
- const parse = (input) => {
15
- input = removeLeadingAndTrailingHTTPWhitespace(input);
16
-
17
- let position = 0;
18
- let type = '';
19
- while (position < input.length && input[position] != '/') {
20
- type += input[position];
21
- ++position;
22
- }
23
-
24
- if (type.length === 0 || !solelyContainsHTTPTokenCodePoints(type)) {
25
- return null;
26
- }
27
-
28
- if (position >= input.length) {
29
- return null;
30
- }
31
-
32
- // Skips past "/"
33
- ++position;
34
-
35
- let subtype = '';
36
- while (position < input.length && input[position] != ';') {
37
- subtype += input[position];
38
- ++position;
39
- }
40
-
41
- subtype = removeTrailingHTTPWhitespace(subtype);
42
-
43
- if (subtype.length === 0 || !solelyContainsHTTPTokenCodePoints(subtype)) {
44
- return null;
45
- }
46
-
47
- const mediaType = {
48
- type: asciiLowercase(type),
49
- subtype: asciiLowercase(subtype),
50
- parameters: new Map()
51
- };
52
-
53
- while (position < input.length) {
54
- // Skip past ";"
55
- ++position;
56
-
57
- while (isHTTPWhitespaceChar(input[position])) {
58
- ++position;
59
- }
60
-
61
- let parameterName = '';
62
- while (position < input.length && input[position] != ';' && input[position] != '=') {
63
- parameterName += input[position];
64
- ++position;
65
- }
66
- parameterName = asciiLowercase(parameterName);
67
-
68
- if (position < input.length) {
69
- if (input[position] == ';') {
70
- continue;
71
- }
72
-
73
- // Skip past "="
74
- ++position;
75
- }
76
-
77
- let parameterValue = null;
78
- if (input[position] == '"') {
79
- [parameterValue, position] = collectAnHTTPQuotedString(input, position);
80
-
81
- while (position < input.length && input[position] != ';') {
82
- ++position;
83
- }
84
- } else {
85
- parameterValue = '';
86
- while (position < input.length && input[position] != ';') {
87
- parameterValue += input[position];
88
- ++position;
89
- }
90
-
91
- parameterValue = removeTrailingHTTPWhitespace(parameterValue);
92
-
93
- if (parameterValue === '') {
94
- continue;
95
- }
96
- }
97
-
98
- if (parameterName.length > 0 && solelyContainsHTTPTokenCodePoints(parameterName) && solelyContainsHTTPQuotedStringTokenCodePoints(parameterValue) && !mediaType.parameters.has(parameterName)) {
99
- mediaType.parameters.set(parameterName, parameterValue);
100
- }
101
- }
102
-
103
- return mediaType;
104
- };
105
-
106
- export default parse;
@@ -1,11 +0,0 @@
1
- export default serialize;
2
- export type MediaType = import('./media-type.js').default;
3
- /** @typedef { import('./media-type.js').default } MediaType */
4
- /**
5
- * A function that serializes the provided {@link mediaType} to a string.
6
- *
7
- * @module serializer
8
- * @param {MediaType} mediaType The media type to serialize.
9
- * @returns {string} The serialized media type.
10
- */
11
- declare function serialize(mediaType: MediaType): string;
package/src/serializer.js DELETED
@@ -1,32 +0,0 @@
1
- import { solelyContainsHTTPTokenCodePoints } from './utils.js';
2
-
3
- /** @typedef { import('./media-type.js').default } MediaType */
4
-
5
- /**
6
- * A function that serializes the provided {@link mediaType} to a string.
7
- *
8
- * @module serializer
9
- * @param {MediaType} mediaType The media type to serialize.
10
- * @returns {string} The serialized media type.
11
- */
12
- const serialize = (mediaType) => {
13
- let serialization = `${mediaType.type}/${mediaType.subtype}`;
14
-
15
- if (mediaType.parameters.size === 0) {
16
- return serialization;
17
- }
18
-
19
- for (let [name, value] of mediaType.parameters) {
20
- serialization += `;${name}=`;
21
-
22
- if (!solelyContainsHTTPTokenCodePoints(value) || value.length === 0) {
23
- value = `"${value.replace(/(["\\])/ug, '\\$1')}"`;
24
- }
25
-
26
- serialization += value;
27
- }
28
-
29
- return serialization;
30
- };
31
-
32
- export default serialize;
package/src/utils.d.ts DELETED
@@ -1,52 +0,0 @@
1
- /** @module utils */
2
- /**
3
- * A function to remove any leading and trailing HTTP whitespace.
4
- *
5
- * @param {string} string The string to process.
6
- * @returns {string} The processed string.
7
- */
8
- export function removeLeadingAndTrailingHTTPWhitespace(string: string): string;
9
- /**
10
- * A function to remove any trailing HTTP whitespace.
11
- *
12
- * @param {string} string The string to process.
13
- * @returns {string} The processed string.
14
- */
15
- export function removeTrailingHTTPWhitespace(string: string): string;
16
- /**
17
- * Determines if the provided character is whitespace.
18
- *
19
- * @param {string} char The character to evaluate.
20
- * @returns {boolean} true if the character is whitespace, false otherwise.
21
- */
22
- export function isHTTPWhitespaceChar(char: string): boolean;
23
- /**
24
- * Determines if the provided string contains only HTTP token code points.
25
- *
26
- * @param {string} string The string to evaluate.
27
- * @returns {boolean} true if the string contains only HTTP token code points.
28
- */
29
- export function solelyContainsHTTPTokenCodePoints(string: string): boolean;
30
- /**
31
- * Determines if the provided string contains only quoted HTTP token code points.
32
- *
33
- * @param {string} string The string to evaluate.
34
- * @returns {boolean} true if the string contains only quoted HTTP token code points.
35
- */
36
- export function solelyContainsHTTPQuotedStringTokenCodePoints(string: string): boolean;
37
- /**
38
- * A function to lower case ASCII characters.
39
- *
40
- * @param {string} string The string to process.
41
- * @returns {string} The processed string with all ASCII characters lower cased.
42
- */
43
- export function asciiLowercase(string: string): string;
44
- /**
45
- * Collects all the HTTP quoted strings.
46
- * This variant only implements it with the extract-value flag set.
47
- *
48
- * @param {string} input The string to process.
49
- * @param {number} position The starting position.
50
- * @returns {Array<string | number>} An array that includes the resulting string and updated position.
51
- */
52
- export function collectAnHTTPQuotedString(input: string, position: number): Array<string | number>;