Socket
Socket
Sign inDemoInstall

funql

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

funql

FUNctional Query Language


Version published
Weekly downloads
24
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

funql

Build Status

FUNctional Query Language

Funql refers to two things:

  1. A minimalist query language that happens to be a superset of JSON.
  2. This module which can be used to parse funql syntax and compile that syntax into various other things.

For the remainder of this document, "funql" will refer to this module, and "funql syntax" will refer to the query language.

Installation

npm

npm install funql

component

component install jdeal/funql

Usage

Parse funql syntax into an AST

var funql = require('funql');

var ast = funql.parse("foo(bar)");

Make an if function compile to a JavaScript if statement

var funql = require('funql');

var jsCompile = funql.compiler({
  call_if: function (node, compile) {
    var args = node.nodes[1].nodes;
    var result = 'if (' + compile(args[0]) + ') {' + compile(args[1]) + '}';
    if (args[2]) {
      result += ' else {' + compile(args[2]) + '}';
    }
    return result;
  },
  name: function (node, compile) {
    return node.value;
  }
});

var jsCode = jsCompile("if(x,y,z)");

// jsCode: if (x) {y} else {z}

Keywords

FAQs

Package last updated on 08 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc