Go to file
icyrockcom e02796e6a4
Merge pull request #5 from Dretch/toArray
Feature request: toArray function
2018-08-05 12:43:30 -04:00
examples Initial 2018-01-17 23:53:58 -05:00
src Add a new toArray function, to make it easy to deal with each matched 2018-08-04 23:02:02 +01: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 Initial 2018-01-17 23:53:58 -05:00
.travis.yml v0.1.0 2018-01-18 00:06:59 -05:00
bower.json Migrate to Purescript 12 2018-07-28 08:40:04 +01:00
LICENSE Initial 2018-01-17 23:53:58 -05:00
package-lock.json Migrate to Purescript 12 2018-07-28 08:40:04 +01:00
package.json Migrate to Purescript 12 2018-07-28 08:40:04 +01:00
psc-package.json Migrate to Purescript 12 2018-07-28 08:40:04 +01:00
README.md Fix the bower link in the README 2018-07-29 10:42:16 +01: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:

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 = find "#fruits" root # 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