npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fiql-query-builder

v1.0.10

Published

This module provides the utility to generate valid FIQL query strings by using a JSON objects or the custom classes provided.

Readme

FIQL Query Builder

Build Status Codacy Badge Codacy Badge

Overview

Feed Item Query Language (FIQL) is a simple, URI-friendly query language for filtering entries of web feeds.

This module provides the utility to generate valid FIQL query strings by using a JSON objects or the custom classes provided.

Installation

$ npm install fiql-query-builder

Usage

FIQL query strings can be produced by supplying a JSON object, or using the Node classes provided.

JSON to FIQL


// var json = ...;

// Using require()
var fiqlQueryBuilder = require('fiql-query-builder');
fiqlQueryBuilder.convertFromJson(json);

// Using ES6 import
import { convertFromJson } from 'fiql-query-builder';
convertFromJson(json);

Basic Operators

| Object Key | Children | Description | | ------------------------ | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | | custom_operator | selector {String} (required) - The left-hand side of the operatoroperator {String} (required) - The custom operatorargs {Object | String} (required) - The child node for operator (right-hand side) | Define a custom basic operator | | equals | selector {String} (required)args {Object | String} (required) | Produces an equality operator (==) | | not_equals | selector {String} (required)args {Object | String} (required)) | Produces an inequality operator (!=) | | less_than | selector {String} (required)args {Object | String} (required) | Produces an less than operator (=lt=) | | less_than_or_equal | selector {String} (required)args {Object | String} (required) | Produces an less than or equal operator (=le=) | | greater_than | selector {String} (required)args {Object | String} (required) | Produces an greater operator (=gt=) | | greater_than_or_equal | selector {String} (required)args {Object | String} (required) | Produces an greater than or equal operator (=ge=) | | in | selector {String} (required)args {Object | String} (required) | Produces an in operator (in) | | out | selector {String} (required)args {Object | String} (required) | Produces an out operator (out) |

Boolean Expressions

| Object Key | Children | Description | | ------------------------ | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | | custom_expression | operator {String} (required) - The custom operatorchildren {Object[]} - The children for the expression | Define a custom boolean expression | | and | _ {Object[]} (required) | Combines child array with an and operator (;) | | or | _ {Object[]} (required) | Combines child array with an or operator (,) |

Grouping

| Object Key | Children | Description | | ------------------------ | ----------------------------------------------------------------------- | ----------------------------------------------------- | | group | _ {Object} (required) - The child expression | Wraps an expression in parentheses |

Node to FIQL


// var node = ...

// Using require()
var fiqlQueryBuilder = require('fiql-query-builder');
fiqlQueryBuilder.convertFromNode(node);

// Using ES6 import
import { convertFromNode, EqNode, AndNode, OpNode } from 'fiql-query-builder';
convertFromNode(node);

LeafNode(value)

The query param is built by traversing the object tree recursively, so a LeafNode is used to represent a primitive value.

| Param | Type | Description | | --------- | --------------------- | ---------------------------------- | | value | string | The string value |

OpNode(selector, operator, args)

A generic operator

| Param | Type | Description | | --------- | --------------------- | ---------------------------------- | | selector | LeafNode | The left-hand side of the operator | | operator | string | The custom operator | | args | GroupNode | LeafNode | ExpNode | OpNode | The child node for operator (right-hand side) |

Subclasses

Standard operator classes have been provided, and can be instantiated using ClassName(selector, args).

  • Equality (==) : EqNode
  • Inequality (!=) : NeqNode
  • Less than (=lt=) : LtNode
  • Less than or equal to (=le=) : LeNode
  • Greater than (=gt=) : GtNode
  • Greater than or equals to (=ge=) : GeNode
  • In (=in=) : InNode
  • Not in (=out=) : NotInNode

ExpNode(operator, children)

A generic boolean expression

| Param | Type | Description | | --------- | ------------------- | ---------------------------------- | | operator | string | The custom operator | | children | Node[] | The child nodes for the expression |

Subclasses

Standard boolean expression classes have been provided, and can be instantiated using ClassName(children).

  • And (;) : AndNode
  • Or (,) : OrNode

GroupNode(exp)

Used to wrap parentheses around a boolean expression.

| Param | Type | Description | | --------- | ------------------- | ---------------------------------- | | exp | ExpNode | The boolean expression to wrap parentheses around |

Examples

JSON to FIQL

Example standard basic operator

var eqJson = convertFromJson({
    equals : {
        selector: 'foo',
        args: 'bar'
    }
});
// eqJson = foo==bar

Example custom basic operator

var customOperatorJson = convertFromJson({
    custom_operator : {
        operator: '¬',
        selector: 'foo',
        args: 'bar' 
    }
});
// customOperatorJson equals: foo¬bar 

Example standard boolean expression

var andJson = convertFromJson({
    and : [
        {
            equals: {
                selector: 'foo',
                args: 'bar'
            }
        },
        {
            not_equals: {
                selector: 'baz',
                args: 'qux'
            }
        }
    ]
});
// andJson equals: foo==bar;baz!=qux

Example custom boolean expression

var customExpressionJson = convertFromJson({
    custom_expression : {
        operator: '*',
        children: [
            {
                equals: {
                    selector: 'foo',
                    args: 'bar'
                }
            },
            {
                not_equals: {
                    selector: 'baz',
                    args: 'qux'
                }
            }
        ]
    }
});
// customExpressionJson equals: foo==bar*baz!=qux

Example grouping and nested arguments

var groupJson = convertFromJson({
    equals : {
        selector: 'k',
        args: {
            group : {
                and : [
                    {
                        less_than: {
                            selector: 'foo',
                            args: 'bar'
                        }
                    },
                    {
                        not_equals: {
                            selector: 'baz',
                            args: 'qux'
                        }
                    }
                ]
            }
        }
    }
});
// groupJson equals: k==(foo=lt=bar,baz!=qux)

Node to FIQL

Example standard basic operator

var eqNode = convertFromNode(
    new EqNode(
        new LeafNode('foo'), 
        new LeafNode('bar')
    )
);
// eqNode = foo==bar

Example custom basic operator

var customOperatorNode = convertFromNode(
    new OpNode(
        new LeafNode('foo'), 
        '¬', 
        new LeafNode('bar')
    )
);
// customOperatorNode equals: foo¬bar 

Example standard boolean expression

var andNode = convertFromNode(
    new AndNode([
        new EqNode(
            new LeafNode('foo'), 
            new LeafNode('bar')
        ),
        new NeqNode(
            new LeafNode('baz'), 
            new LeafNode('qux')
        )
    ])
);
// andNode equals: foo==bar;baz!=qux

Example custom boolean expression

var customExpressionNode = convertFromNode(
    new ExpNode('*', [
        new EqNode('foo', 'bar'),
        new NeqNode('baz', 'qux')
    ])
);
// customExpressionNode equals: foo==bar*baz!=qux

Example grouping and nested arguments

var groupNode = convertFromNode(
    new EqNode(
        new LeafNode('k'),
        new GroupNode(
            new AndNode([
                new LtNode(
                    new LeafNode('foo'),
                    new LeafNode('bar')
                ),
                new NeqNode(
                    new LeafNode('baz'),
                    new LeafNode('qux')
                )
            ])
        )
    )
);
// groupNode equals: k==(foo=lt=bar,baz!=qux)

License

This project is licensed under MIT License