JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q39511F
  • 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.

You can play with it online : DEMO

##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:

// using an ES6 transpiler, like babel
import {parse} from "gdom-node"

// not using an ES6 transpiler
var parse = require("gdom-node").parse

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(function(result){
    //do something
})

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

import {Schema} from "gdom-node"

//or

var Schema = require("gdom-node").Schema

##Test

npm test