Skip to content

Commit f2ba32d

Browse files
committed
Remove support for passing space directly
1 parent 08fb392 commit f2ba32d

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

lib/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,18 @@ const one = zwitch('type', {
6262
unknown
6363
})
6464

65-
// To do: next major: remove `space` shortcut.
6665
/**
6766
* Turn a hast tree into a xast tree.
6867
*
6968
* @param {HastNodes} tree
7069
* hast tree to transform.
71-
* @param {Options | Space | null | undefined} [options]
70+
* @param {Options | null | undefined} [options]
7271
* Configuration (optional).
7372
* @returns {XastNodes}
7473
* xast tree.
7574
*/
7675
export function toXast(tree, options) {
77-
const settings =
78-
typeof options === 'string' ? {space: options} : options || emptyOptions
76+
const settings = options || emptyOptions
7977

8078
return one(tree, {
8179
schema: settings.space === 'svg' ? svg : html,

readme.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* [Install](#install)
1818
* [Use](#use)
1919
* [API](#api)
20-
* [`toXast(tree[, space|options])`](#toxasttree-spaceoptions)
20+
* [`toXast(tree[, options])`](#toxasttree-options)
2121
* [`Options`](#options)
2222
* [`Space`](#space-1)
2323
* [Types](#types)
@@ -108,16 +108,14 @@ console.log(toXml(xast))
108108
This package exports the identifier [`toXast`][toxast].
109109
There is no default export.
110110

111-
### `toXast(tree[, space|options])`
111+
### `toXast(tree[, options])`
112112

113113
Turn a [hast][] tree into a [xast][] tree.
114114

115115
###### Parameters
116116

117117
* `tree` ([`HastNode`][hast-node])
118118
— hast tree to transform
119-
* `space` ([`Space`][space], optional)
120-
— same as options of `{space: space}`
121119
* `options` ([`Options`][options], optional)
122120
— configuration
123121

@@ -252,7 +250,7 @@ abide by its terms.
252250
253251
[xast-node]: https://github.com/syntax-tree/xast#nodes
254252
255-
[toxast]: #toxasttree-spaceoptions
253+
[toxast]: #toxasttree-options
256254
257255
[options]: #options
258256

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test('main', async function (t) {
4141

4242
await t.test('should support `space` (svg)', async function () {
4343
assert.deepEqual(
44-
toXast(s('circle'), 'svg'),
44+
toXast(s('circle'), {space: 'svg'}),
4545
x('circle', {xmlns: webNamespaces.svg})
4646
)
4747
})
@@ -318,7 +318,7 @@ test('attributes', async function (t) {
318318
},
319319
[]
320320
),
321-
'svg'
321+
{space: 'svg'}
322322
),
323323
x('use', {
324324
xmlns: webNamespaces.svg,

0 commit comments

Comments
 (0)