JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q39652F
  • License ISC

Next gen html parser with graphql

Package Exports

  • gdom-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gdom-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gdom-node

Port of gdom for node.js. Based on axios & cheerio.

##Install

npm i -S gdom-node

##Usage Import parse function from gdom-node, then pass your query as argument, result of execution will be a promise:

import {parse} from "gdom-node"

let query = `{
  page(url:"http://news.ycombinator.com") {
    items: query(selector:"tr.athing") {
      rank: text(selector:"td span.rank")
      title: text(selector:"td.title a")
      sitebit: text(selector:"span.comhead a")
      url: attr(selector:"td.title a", name:"href")
      attrs: next {
         score: text(selector:"span.score")   
      }
    }
  }
}`

parse(query).then((result)=>{
    //do something
})

You can also import graphQL Schema, if you need it:

import {parse, Schema}

##Test

npm test