opml-to-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

opml-to-json Build Status

Convert OPML to JSON(JavaScript Object).

Installation

npm install opml-to-json

Usage

Example OPML file.

<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
  <head>
    <title>title</title>
    <expansionState>0,2</expansionState>
  </head>
  <body>
    <outline text="H1">
      <outline text="H2 Text"/>
      <outline text="H2">
        <outline text="text"/>
      </outline>
    </outline>
    <outline text="H1 text"/>
  </body>
</opml>
import { opmlToJSON } from "opml-to-json";

const json = await opmlToJSON(xml);
const expected = {
    "title": "title",
    "children": [
        {
            "text": "H1", "children": [
                { "text": "H2 Text" },
                {
                    "text": "H2", "children": [
                        { "text": "text" }
                    ]
                }
            ]
        },
        { "text": "H1 text" }
    ]
};
assert.deepStrictEqual(json, expected);

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    57
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    57
  • 1.0.0
    1
  • 0.0.3
    6
  • 0.0.2
    1

Package Sidebar

Install

npm i opml-to-json

Weekly Downloads

65

Version

1.0.1

License

MIT

Unpacked Size

10.7 kB

Total Files

6

Last publish

Collaborators

  • azu