From a6546424a270f90818d8c486b1ab55ce818ce886 Mon Sep 17 00:00:00 2001 From: Paul Meinhardt Date: Sun, 14 Nov 2021 11:57:35 +0100 Subject: [PATCH] [#6] Use named export https://github.com/bitcrowd/mdast-util-from-adf/issues/6 --- index.test.ts | 2 +- index.ts | 4 +++- package.json | 2 +- readme.md | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.test.ts b/index.test.ts index 8daa941..f2079ab 100644 --- a/index.test.ts +++ b/index.test.ts @@ -5,7 +5,7 @@ import type { import Chance from "chance"; import { u } from "unist-builder"; -import convert from "."; +import { fromADF as convert } from "."; const seed = process.env.SEED; const random = seed ? new Chance(seed) : new Chance(); diff --git a/index.ts b/index.ts index a46a747..eeb7899 100644 --- a/index.ts +++ b/index.ts @@ -263,7 +263,7 @@ function assert(value: unknown, message = ""): asserts value { if (!value) throw new AssertionError(message); } -export default function convert(doc: ADFDoc): MDASTRoot { +function convert(doc: ADFDoc): MDASTRoot { assert(doc.version === 1, `unknown document version ${doc.version}`); const tree: MDASTRoot = u("root", []); @@ -290,3 +290,5 @@ export default function convert(doc: ADFDoc): MDASTRoot { return tree; } + +export const fromADF = convert; diff --git a/package.json b/package.json index b501e5b..378c705 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mdast-util-from-adf", - "version": "1.1.0", + "version": "2.0.0-pre", "description": "Convert from Atlassian Document Format to Markdown Abstract Syntax Tree", "license": "MIT", "author": "", diff --git a/readme.md b/readme.md index 383de7f..d30429c 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ npm install mdast-util-from-adf Say we have the following script, `example.js`: ```js -import fromADF from "mdast-util-from-adf"; +import { fromADF } from "mdast-util-from-adf"; import { toMarkdown } from "mdast-util-to-markdown"; const doc = {