Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@movable/data-sources-parser

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@movable/data-sources-parser

This library contains a library for parsing Data Sources responses in a consistent way.

  • 0.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
35
increased by9.38%
Maintainers
6
Weekly downloads
 
Created
Source

Movable Ink: Data Sources Parser

This library contains a library for parsing Data Sources responses in a consistent way.

HTMLNormalizer

This class takes an HTML string and the URL of the HTML in its constructor. For example:

import { HTMLNormalizer } from 'data-sources-parser';

new HTMLNormalizer(`
  <html>
   <body>
    <h1>Hello, world!</h1>
   </body>
  </html>
`, 'https://www.movableink.com');

normalizer.document

This provides the created document object.

import { HTMLNormalizer } from 'data-sources-parser';
const { document } = new HTMLNormalizer('<html>...</html>', 'https://www.movableink.com');

const header = document.querySelector('h1');

normalizer.baseURL

This provides the base URL of the page, taking into account any <base> tag and the provided URL:

import { HTMLNormalizer } from 'data-sources-parser';
const { baseURL } = new HTMLNormalizer('<base href="/home/" />', 'https://www.movableink.com');

console.log(baseURL); // https://www.movableink.com/home/

normalizers.absolutizePath

This takes a path (likely from an href or src) and converts it into its fully qualified URL, taking into account the URL and <base> tags of the page.

import { HTMLNormalizer } from 'data-sources-parser';
const normalizer = new HTMLNormalizer('<base href="/home/" />', 'https://www.movableink.com');

const logoURL = normalizer.absolutizePath('images/logo.png');
console.log(logoURL); // https://www.movableink.com/home/images/logo.png

Releases

To release a change, run the release command.

(This uses release-it for managing the releases).

yarn run release

By default, this will be a patch release. If you wish to release a different change:

yarn run release patch;
yarn run release minor;
yarn run release major;
yarn run release 2.8.3;

FAQs

Package last updated on 25 Sep 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc