diff --git a/src/Cheerio.js b/src/Cheerio.js index 04f5764..d723f8a 100644 --- a/src/Cheerio.js +++ b/src/Cheerio.js @@ -1,4 +1,4 @@ -import {load} from 'cheerio' +import { load } from 'cheerio' /** @typedef {import('cheerio').Element} Element */ /** @typedef {import('cheerio').Cheerio} CheerioNode */ @@ -20,10 +20,13 @@ export const loadImpl = html => () => { } /** @type {(_: CheerioNode) => () => Array} */ -export const toArrayImpl = n => () => Array(n.length) .fill(undefined) .map((_, ix) => n.slice(ix, ix + 1)) +export const toArrayImpl = n => () => + Array(n.length) + .fill(undefined) + .map((_, ix) => n.slice(ix, ix + 1)) /** @type {(_: CheerioNode) => () => CheerioNode | null} */ -export const toNullableImpl = n => () => n.length === 0 ? null : n.first() +export const toNullableImpl = n => () => (n.length === 0 ? null : n.first()) /** @type {(_: CheerioNode) => () => CheerioNode} */ export const childrenImpl = n => () => n.children() diff --git a/test/Test/Cheerio.purs b/test/Test/Cheerio.purs index 5b89e9e..b1bf1b7 100644 --- a/test/Test/Cheerio.purs +++ b/test/Test/Cheerio.purs @@ -24,10 +24,10 @@ suites = do test "attr" do doc <- liftEffect $ Cheerio.load htmlEx fruits <- liftEffect - $ liftMaybe (error "ul should have id") - =<< Cheerio.attr "id" - =<< liftMaybe (error "ul should exist") - =<< Cheerio.findFirst "ul" doc + $ liftMaybe (error "ul should have id") + =<< Cheerio.attr "id" + =<< liftMaybe (error "ul should exist") + =<< Cheerio.findFirst "ul" doc Assert.equal "fruits" fruits suite "Traversing" do @@ -40,10 +40,10 @@ suites = do doc <- liftEffect $ Cheerio.load htmlEx pear <- liftEffect $ liftMaybe (error "pear should exist") =<< Cheerio.findFirst ".pear" doc parentId <- liftEffect - $ liftMaybe (error "parent should have id") - =<< Cheerio.attr "id" - =<< liftMaybe (error "parent should exist") - =<< Cheerio.parent pear + $ liftMaybe (error "parent should have id") + =<< Cheerio.attr "id" + =<< liftMaybe (error "parent should exist") + =<< Cheerio.parent pear Assert.equal "fruits" parentId test "siblings" do