File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export function requestDataToFetchBody(data: RequestDataPayload): [BodyInit, Hea
1212 if ( typeof data === "string" ) {
1313 return [ data , { } ] ;
1414 } else if ( isBuffer ( data ) ) {
15- return [ data as Buffer , { } ] ;
15+ return [ data as BodyInit , { } ] ;
1616 } else if ( isArrayBuffer ( data ) ) {
1717 return [ data as ArrayBuffer , { } ] ;
1818 } else if ( data && typeof data === "object" ) {
Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ enum PropertyType {
2121 Original = "original"
2222}
2323
24+ function toJPathString (
25+ jPath : string | { toString : ( sep ?: string , includeNS ?: boolean ) => string }
26+ ) : string {
27+ if ( typeof jPath === "string" ) {
28+ return jPath ;
29+ }
30+ return jPath . toString ( "." , false ) ;
31+ }
32+
2433function getParser ( {
2534 attributeNamePrefix,
2635 attributeParsers,
@@ -32,14 +41,16 @@ function getParser({
3241 textNodeName : "text" ,
3342 ignoreAttributes : false ,
3443 removeNSPrefix : true ,
44+ jPath : false ,
3545 numberParseOptions : {
3646 hex : true ,
3747 leadingZeros : false
3848 } ,
3949 attributeValueProcessor ( _ , attrValue , jPath ) {
50+ const pathStr = toJPathString ( jPath ) ;
4051 for ( const processor of attributeParsers ) {
4152 try {
42- const value = processor ( jPath , attrValue ) ;
53+ const value = processor ( pathStr , attrValue ) ;
4354 if ( value !== attrValue ) {
4455 return value ;
4556 }
@@ -50,9 +61,10 @@ function getParser({
5061 return attrValue ;
5162 } ,
5263 tagValueProcessor ( tagName , tagValue , jPath ) {
64+ const pathStr = toJPathString ( jPath ) ;
5365 for ( const processor of tagParsers ) {
5466 try {
55- const value = processor ( jPath , tagValue ) ;
67+ const value = processor ( pathStr , tagValue ) ;
5668 if ( value !== tagValue ) {
5769 return value ;
5870 }
You can’t perform that action at this time.
0 commit comments