Demo for query storing
Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/nth-check/LICENSE b/node_modules/nth-check/LICENSE
new file mode 100644
index 0000000..c464f86
--- /dev/null
+++ b/node_modules/nth-check/LICENSE
@@ -0,0 +1,11 @@
+Copyright (c) Felix Böhm
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/nth-check/README.md b/node_modules/nth-check/README.md
new file mode 100644
index 0000000..53c6c22
--- /dev/null
+++ b/node_modules/nth-check/README.md
@@ -0,0 +1,51 @@
+# nth-check [](https://travis-ci.org/fb55/nth-check)
+
+A performant nth-check parser & compiler.
+
+### About
+
+This module can be used to parse & compile nth-checks, as they are found in CSS 3's `nth-child()` and `nth-last-of-type()`.
+
+`nth-check` focusses on speed, providing optimized functions for different kinds of nth-child formulas, while still following the [spec](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo).
+
+### API
+
+```js
+var nthCheck = require("nth-check");
+```
+
+##### `nthCheck(formula)`
+
+First parses, then compiles the formula.
+
+##### `nthCheck.parse(formula)`
+
+Parses the expression, throws a `SyntaxError` if it fails, otherwise returns an array containing two elements.
+
+__Example:__
+
+```js
+nthCheck.parse("2n+3") //[2, 3]
+```
+
+##### `nthCheck.compile([a, b])`
+
+Takes an array with two elements (as returned by `.parse`) and returns a highly optimized function.
+
+If the formula doesn't match any elements, it returns [`boolbase`](https://github.com/fb55/boolbase)'s `falseFunc`, otherwise, a function accepting an _index_ is returned, which returns whether or not a passed _index_ matches the formula. (Note: The spec starts counting at `1`, the returned function at `0`).
+
+__Example:__
+```js
+var check = nthCheck.compile([2, 3]);
+
+check(0) //false
+check(1) //false
+check(2) //true
+check(3) //false
+check(4) //true
+check(5) //false
+check(6) //true
+```
+
+---
+License: BSD
diff --git a/node_modules/nth-check/compile.js b/node_modules/nth-check/compile.js
new file mode 100644
index 0000000..77f2436
--- /dev/null
+++ b/node_modules/nth-check/compile.js
@@ -0,0 +1,40 @@
+module.exports = compile;
+
+var BaseFuncs = require("boolbase"),
+ trueFunc = BaseFuncs.trueFunc,
+ falseFunc = BaseFuncs.falseFunc;
+
+/*
+ returns a function that checks if an elements index matches the given rule
+ highly optimized to return the fastest solution
+*/
+function compile(parsed){
+ var a = parsed[0],
+ b = parsed[1] - 1;
+
+ //when b <= 0, a*n won't be possible for any matches when a < 0
+ //besides, the specification says that no element is matched when a and b are 0
+ if(b < 0 && a <= 0) return falseFunc;
+
+ //when a is in the range -1..1, it matches any element (so only b is checked)
+ if(a ===-1) return function(pos){ return pos <= b; };
+ if(a === 0) return function(pos){ return pos === b; };
+ //when b <= 0 and a === 1, they match any element
+ if(a === 1) return b < 0 ? trueFunc : function(pos){ return pos >= b; };
+
+ //when a > 0, modulo can be used to check if there is a match
+ var bMod = b % a;
+ if(bMod < 0) bMod += a;
+
+ if(a > 1){
+ return function(pos){
+ return pos >= b && pos % a === bMod;
+ };
+ }
+
+ a *= -1; //make `a` positive
+
+ return function(pos){
+ return pos <= b && pos % a === bMod;
+ };
+}
\ No newline at end of file
diff --git a/node_modules/nth-check/index.js b/node_modules/nth-check/index.js
new file mode 100644
index 0000000..3253bbd
--- /dev/null
+++ b/node_modules/nth-check/index.js
@@ -0,0 +1,9 @@
+var parse = require("./parse.js"),
+ compile = require("./compile.js");
+
+module.exports = function nthCheck(formula){
+ return compile(parse(formula));
+};
+
+module.exports.parse = parse;
+module.exports.compile = compile;
\ No newline at end of file
diff --git a/node_modules/nth-check/package.json b/node_modules/nth-check/package.json
new file mode 100644
index 0000000..14eba31
--- /dev/null
+++ b/node_modules/nth-check/package.json
@@ -0,0 +1,60 @@
+{
+ "_from": "nth-check@^1.0.2",
+ "_id": "nth-check@1.0.2",
+ "_inBundle": false,
+ "_integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
+ "_location": "/nth-check",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "nth-check@^1.0.2",
+ "name": "nth-check",
+ "escapedName": "nth-check",
+ "rawSpec": "^1.0.2",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.2"
+ },
+ "_requiredBy": [
+ "/css-select"
+ ],
+ "_resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
+ "_shasum": "b2bd295c37e3dd58a3bf0700376663ba4d9cf05c",
+ "_spec": "nth-check@^1.0.2",
+ "_where": "C:\\Users\\marcr\\Desktop\\KorAp\\Git\\Kalamar\\node_modules\\css-select",
+ "author": {
+ "name": "Felix Boehm",
+ "email": "me@feedic.com"
+ },
+ "bugs": {
+ "url": "https://github.com/fb55/nth-check/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "boolbase": "~1.0.0"
+ },
+ "deprecated": false,
+ "description": "performant nth-check parser & compiler",
+ "files": [
+ "compile.js",
+ "index.js",
+ "parse.js"
+ ],
+ "homepage": "https://github.com/fb55/nth-check",
+ "keywords": [
+ "nth-child",
+ "nth",
+ "css"
+ ],
+ "license": "BSD-2-Clause",
+ "main": "index.js",
+ "name": "nth-check",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fb55/nth-check.git"
+ },
+ "scripts": {
+ "test": "node test"
+ },
+ "version": "1.0.2"
+}
diff --git a/node_modules/nth-check/parse.js b/node_modules/nth-check/parse.js
new file mode 100644
index 0000000..5302951
--- /dev/null
+++ b/node_modules/nth-check/parse.js
@@ -0,0 +1,40 @@
+module.exports = parse;
+
+//following http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
+
+//[ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]?
+var re_nthElement = /^([+\-]?\d*n)?\s*(?:([+\-]?)\s*(\d+))?$/;
+
+/*
+ parses a nth-check formula, returns an array of two numbers
+*/
+function parse(formula){
+ formula = formula.trim().toLowerCase();
+
+ if(formula === "even"){
+ return [2, 0];
+ } else if(formula === "odd"){
+ return [2, 1];
+ } else {
+ var parsed = formula.match(re_nthElement);
+
+ if(!parsed){
+ throw new SyntaxError("n-th rule couldn't be parsed ('" + formula + "')");
+ }
+
+ var a;
+
+ if(parsed[1]){
+ a = parseInt(parsed[1], 10);
+ if(isNaN(a)){
+ if(parsed[1].charAt(0) === "-") a = -1;
+ else a = 1;
+ }
+ } else a = 0;
+
+ return [
+ a,
+ parsed[3] ? parseInt((parsed[2] || "") + parsed[3], 10) : 0
+ ];
+ }
+}