@acot/html-pickup
TypeScript icon, indicating that this package has built-in type declarations

0.0.19 • Public • Published

@acot/html-pickup

Use the CSS Selector to pick up the elements from the HTML string.

Installation

Install via npm:

$ npm install --save @acot/html-pickup

Usage

T.B.A

import { pickup } from '@acot/html-pickup';

const html = `
<html>
  <body>
    <header>
      <h1>Title</h1>
    </header>

    <main id="container">
      <h2>Sub title</h2>
      <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
      </ul>
    </main>
  </body>
</html>
`;

const el = pickup(html, '#container');

console.log(el);
// "<main id="container"><h2>Sub title</h2><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul></main>"

Dependencies (6)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @acot/html-pickup

    Weekly Downloads

    151

    Version

    0.0.19

    License

    MIT

    Unpacked Size

    6.64 kB

    Total Files

    5

    Last publish

    Collaborators

    • wadackel