gquery

0.1.0 • Public • Published

gQuery

Generic jQuery

gQuery provides a jQuery-esque API for querying ordinary JavaScript objects.

Usage

var gQuery = require('gquery');
 
var $ = gQuery([
  { id: 'foo', tag: 1 },
  { class: 'bar', tag: 2 },
  {
    class: 'baz',
    tag: 3,
    children: [
      { id: 'foo', tag: 4 },
      ( class: 'bar', tag: 5 )
    ]
  }
]);
 
$('#foo');          // => [{ id: 'foo', tag: 1 }, { id: 'foo', tag: 4 }]
$('.bar');          // => [{ class: 'bar', tag: 2 }]
$('.baz > #foo');   // => [{ id: 'foo', tag: 4 }]
$('.bar[tag="2"]'); // => [{ class: 'bar', tag: 2 }]

Readme

Keywords

none

Package Sidebar

Install

npm i gquery

Weekly Downloads

2

Version

0.1.0

License

none

Last publish

Collaborators

  • dtao