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 @@ -62,20 +62,18 @@ const one = zwitch('type', {
62
62
unknown
63
63
} )
64
64
65
- // To do: next major: remove `space` shortcut.
66
65
/**
67
66
* Turn a hast tree into a xast tree.
68
67
*
69
68
* @param {HastNodes } tree
70
69
* hast tree to transform.
71
- * @param {Options | Space | null | undefined } [options]
70
+ * @param {Options | null | undefined } [options]
72
71
* Configuration (optional).
73
72
* @returns {XastNodes }
74
73
* xast tree.
75
74
*/
76
75
export function toXast ( tree , options ) {
77
- const settings =
78
- typeof options === 'string' ? { space : options } : options || emptyOptions
76
+ const settings = options || emptyOptions
79
77
80
78
return one ( tree , {
81
79
schema : settings . space === 'svg' ? svg : html ,
Original file line number Diff line number Diff line change 17
17
* [ Install] ( #install )
18
18
* [ Use] ( #use )
19
19
* [ API] ( #api )
20
- * [ ` toXast(tree[, space| options]) ` ] ( #toxasttree-spaceoptions )
20
+ * [ ` toXast(tree[, options]) ` ] ( #toxasttree-options )
21
21
* [ ` Options ` ] ( #options )
22
22
* [ ` Space ` ] ( #space-1 )
23
23
* [ Types] ( #types )
@@ -108,16 +108,14 @@ console.log(toXml(xast))
108
108
This package exports the identifier [ ` toXast ` ] [ toxast ] .
109
109
There is no default export.
110
110
111
- ### ` toXast(tree[, space| options]) `
111
+ ### ` toXast(tree[, options]) `
112
112
113
113
Turn a [ hast] [ ] tree into a [ xast] [ ] tree.
114
114
115
115
###### Parameters
116
116
117
117
* ` tree ` ([ ` HastNode ` ] [ hast-node ] )
118
118
— hast tree to transform
119
- * ` space ` ([ ` Space ` ] [ space ] , optional)
120
- — same as options of ` {space: space} `
121
119
* ` options ` ([ ` Options ` ] [ options ] , optional)
122
120
— configuration
123
121
@@ -252,7 +250,7 @@ abide by its terms.
252
250
253
251
[xast-node]: https://github.com/syntax-tree/xast#nodes
254
252
255
- [toxast]: #toxasttree-spaceoptions
253
+ [toxast]: #toxasttree-options
256
254
257
255
[options]: #options
258
256
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ test('main', async function (t) {
41
41
42
42
await t . test ( 'should support `space` (svg)' , async function ( ) {
43
43
assert . deepEqual (
44
- toXast ( s ( 'circle' ) , 'svg' ) ,
44
+ toXast ( s ( 'circle' ) , { space : 'svg' } ) ,
45
45
x ( 'circle' , { xmlns : webNamespaces . svg } )
46
46
)
47
47
} )
@@ -318,7 +318,7 @@ test('attributes', async function (t) {
318
318
} ,
319
319
[ ]
320
320
) ,
321
- 'svg'
321
+ { space : 'svg' }
322
322
) ,
323
323
x ( 'use' , {
324
324
xmlns : webNamespaces . svg ,
You can’t perform that action at this time.
0 commit comments