Go to file
dependabot[bot] 14e91e917c
Bump nth-check and cheerio
Bumps [nth-check](https://github.com/fb55/nth-check) to 2.1.1 and updates ancestor dependency [cheerio](https://github.com/cheeriojs/cheerio). These dependencies need to be updated together.


Updates `nth-check` from 1.0.2 to 2.1.1
- [Release notes](https://github.com/fb55/nth-check/releases)
- [Commits](https://github.com/fb55/nth-check/compare/v1.0.2...v2.1.1)

Updates `cheerio` from 1.0.0-rc.3 to 1.0.0-rc.12
- [Release notes](https://github.com/cheeriojs/cheerio/releases)
- [Commits](https://github.com/cheeriojs/cheerio/compare/1.0.0-rc.3...v1.0.0-rc.12)

---
updated-dependencies:
- dependency-name: nth-check
  dependency-type: indirect
- dependency-name: cheerio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-20 04:38:05 +00:00
examples Move to spago 2020-04-17 22:03:59 -04:00
src Move to spago 2020-04-17 22:03:59 -04:00
test/Test Add a new toArray function, to make it easy to deal with each matched 2018-08-04 23:02:02 +01:00
.gitignore Update to psc 0.14.3, dep ver and spago.dhall, fix typos 2021-08-16 22:42:37 -04:00
.purs-repl Move to spago 2020-04-17 22:03:59 -04:00
.travis.yml v0.2.2 2020-04-19 13:44:55 -04:00
bower.json Update to psc 0.14.3, dep ver and spago.dhall, fix typos 2021-08-16 22:42:37 -04:00
LICENSE Initial 2018-01-17 23:53:58 -05:00
package-lock.json Bump nth-check and cheerio 2023-04-20 04:38:05 +00:00
package.json Bump nth-check and cheerio 2023-04-20 04:38:05 +00:00
packages.dhall Update to psc 0.14.3, dep ver and spago.dhall, fix typos 2021-08-16 22:42:37 -04:00
psc-package.json Move to spago 2020-04-17 22:03:59 -04:00
README.md Move to spago 2020-04-17 22:03:59 -04:00
spago.dhall Update to psc 0.14.3, dep ver and spago.dhall, fix typos 2021-08-16 22:42:37 -04:00

Build Status

Description

Basic bindings for cheerio. Only includes read-only functionality for now.

Installation

Install cheerio dependency:

$ npm install --save cheerio

Install this package using spago:

  • Add package to your spago.dhall:
...
dependencies = [ ..., "cheerio" ]
...
  • Install packages by running:
$ spago install

Example

From basic example.

Imports:

import Cheerio (Cheerio, find, length)
import Cheerio.Static (loadRoot)

Example html:

htmlEx :: String
htmlEx = """
  <ul id="fruits">
    <li class="apple">Apple</li>
    <li class="orange">Orange</li>
    <li class="pear">Pear</li>
  </ul>
"""

Load it and get the root element:

root :: Cheerio
root = loadRoot htmlEx

Use the query functions:

let fruitCount = root # find "#fruits" # find "li" # length
in log $ "Number of fruits: " <> show fruitCount

For more examples, please take a look at the unit tests. They cover most of the read-only cheerio functions.

Issues or suggestions

If you run into any issues or have suggestions, please open an issue or submit a pull request. Both are welcome!

Be prepared to wait more than a couple of days for a response though :)

License

MIT