File tree Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,9 @@ $ npm i posthtml posthtml-url-parameters
2525const posthtml = require (' posthtml' )
2626const urlParams = require (' posthtml-url-parameters' )
2727
28- const parameters = {foo: ' bar' , baz: ' qux' }
29-
3028posthtml ([
3129 urlParams ({
32- parameters: parameters
30+ parameters: { foo : ' bar ' , baz : ' qux ' }
3331 })
3432 ])
3533 .process (' <a href="https://example.com">Test</div>' )
@@ -72,7 +70,7 @@ require('posthtml-url-parameters')({
7270})
7371```
7472
75- ### ` options `
73+ ### ` qs `
7674
7775Default: ` undefined `
7876
@@ -84,12 +82,10 @@ For example, you can disable encoding:
8482const posthtml = require (' posthtml' )
8583const urlParams = require (' posthtml-url-parameters' )
8684
87- const parameters = {foo: ' @Bar@' }
88-
8985posthtml ([
9086 urlParams ({
91- parameters: parameters ,
92- options : {
87+ parameters: { foo : ' @Bar@ ' } ,
88+ qs : {
9389 encode: false
9490 }
9591 })
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module.exports = config => tree => {
2323 parsed . query [ item ] = config . parameters [ item ]
2424 } )
2525
26- node . attrs . href = qs . stringifyUrl ( parsed , config . options )
26+ node . attrs . href = qs . stringifyUrl ( parsed , config . qs )
2727 }
2828
2929 return node
Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ test('Skip if invalid URL', t => {
3535
3636test ( 'Does not encode parameters if `encode` option is false' , t => {
3737 return process ( t , 'no-encode' , {
38- options : { encode : false } ,
38+ qs : { encode : false } ,
3939 parameters : { foo : '@Bar@' }
4040 } )
4141} )
4242
4343test ( 'Does not sort parameters if `sort` option is false' , t => {
4444 return process ( t , 'no-sort' , {
45- options : { sort : false } ,
45+ qs : { sort : false } ,
4646 parameters : { foo : 'bar' , baz : 'qux' }
4747 } )
4848} )
You can’t perform that action at this time.
0 commit comments