Socket
Socket
Sign inDemoInstall

opml-to-json

Package Overview
Dependencies
7
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    opml-to-json

convert opml to json.


Version published
Maintainers
1
Install size
665 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 04 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc