Skip to content

Commit 4077865

Browse files
committed
remove unused code, and switch to String.fromCodePoint
1 parent 1aadcec commit 4077865

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

src/utils.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const hexFromBuffer = (buffer: ArrayBuffer): string => {
3131
hex[j++] = HEX_CHARS[bytes[i]! >> 4]!;
3232
hex[j++] = HEX_CHARS[bytes[i]! & 0x0f]!;
3333
}
34-
return String.fromCharCode(...hex);
34+
return String.fromCodePoint(...hex);
3535
};
3636

3737
/**
@@ -155,38 +155,6 @@ export const parseXml = (input: string): XmlValue => {
155155
return Object.keys(result).length > 0 ? result : unescapeXml(xmlContent.trim());
156156
};
157157

158-
// export const parseXml = (input: string): XmlValue => {
159-
// const xml = input.replace(/<\?xml[^?]*\?>\s*/, '');
160-
// const result: XmlMap = {};
161-
// let i = 0;
162-
// const len = xml.length;
163-
164-
// while (i < len) {
165-
// const tagStart = xml.indexOf('<', i);
166-
// if (tagStart === -1 || xml[tagStart + 1] === '/') {
167-
// break;
168-
// }
169-
170-
// const tagEnd = xml.indexOf('>', tagStart);
171-
// const tag = xml.slice(tagStart + 1, tagEnd);
172-
// const closeTag = `</${tag}>`;
173-
// const closeIdx = xml.indexOf(closeTag, tagEnd);
174-
175-
// if (closeIdx === -1) {
176-
// i = tagEnd + 1;
177-
// continue;
178-
// }
179-
180-
// const inner = xml.slice(tagEnd + 1, closeIdx);
181-
// const node = inner.includes('<') ? parseXml(inner) : unescapeXml(inner);
182-
183-
// const cur = result[tag];
184-
// result[tag] = cur === undefined ? node : Array.isArray(cur) ? [...cur, node] : [cur, node];
185-
// i = closeIdx + closeTag.length;
186-
// }
187-
// return Object.keys(result).length ? result : unescapeXml(xml.trim());
188-
// };
189-
190158
/**
191159
* Encode a character as a URI percent-encoded hex value
192160
* @param c Character to encode

0 commit comments

Comments
 (0)