# harmon-cheerio

> `harmon-cheerio` makes it simple to perform transforms using `harmon` by using `cheerio`. It also makes it possible to transform elements asynchronously using Promises.

Latest version **0.1.2** (published 2018-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install harmon-cheerio
pnpm add harmon-cheerio
yarn add harmon-cheerio
bun add harmon-cheerio
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-06-27 |
| First published | 2018-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jacob Marshall |
| Maintainers | jacobmarshall |
| Keywords | harmon, cheerio |

## Links

- npm: https://www.npmjs.com/package/harmon-cheerio
- Repository: https://github.com/jmshal/harmon-cheerio
- Homepage: https://github.com/jmshal/harmon-cheerio#readme
- Issues: https://github.com/jmshal/harmon-cheerio/issues
- npm.io page: https://npm.io/package/harmon-cheerio

## Dependencies (1)

- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2018-06-27
- 0.1.1 — 2018-06-27
- 0.1.0 — 2018-06-27

## README

# harmon-cheerio

`harmon-cheerio` makes it simple to perform transforms using `harmon` by using `cheerio`. It also makes it possible to transform elements asynchronously using Promises.

This package is currently under development. Please use at your own discretion.

## Example

```js
const harmonCheerio = require('harmon-cheerio');

// ...

app.use(harmon([], [
  {
    query: 'body',
    func: harmonCheerio((element, req) => {
      if (doesUserAgentRequirePolyfill(req)) {
        element.append('<script src="/path/to/polyfill.js"></script>');
      }
    })
  }
]));
```

```js
const harmonCheerio = require('harmon-cheerio');

// ...

app.use(harmon([], [
  {
    query: 'script#session-placeholder',
    func: harmonCheerio(async (element, req) => {
      // pretend we need to make a request to get the user's session data
      const sessionData = await getSessionData(req.session.id);
      element.text(`const SESSION = ${JSON.stringify(sessionData)};`);
    })
  }
]));
```

See [cheerio](https://github.com/cheeriojs/cheerio#api) for the full list of methods you have access to.

## License

MIT ❤️

---
_Source: https://npm.io/package/harmon-cheerio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
