Comparing version 0.11.0 to 0.12.0
@@ -13,8 +13,4 @@ /** | ||
// Version | ||
Object.defineProperty(loader, 'version', { | ||
value: '0.6.1' | ||
}); | ||
// Attaching the other classes to the loader | ||
loader.loader = loader; | ||
loader.helpers = helpers; | ||
@@ -21,0 +17,0 @@ loader.Batch = Batch; |
{ | ||
"name": "decypher", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "A handful of cypher utilities for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
15
query.js
@@ -15,3 +15,5 @@ /** | ||
var STATEMENTS = require('./syntax.js').STATEMENTS; | ||
var SYNTAX = require('./syntax.js'), | ||
STATEMENTS = SYNTAX.STATEMENTS, | ||
EMPTY_STATEMENTS = SYNTAX.EMPTY_STATEMENTS; | ||
@@ -138,2 +140,4 @@ var INTERPOLATION_REGEX = /{([\w\d]+)}/g; | ||
var emptyStatement = statement in EMPTY_STATEMENTS; | ||
Query.prototype[methodName] = function(parts, params) { | ||
@@ -166,5 +170,10 @@ var inner = null; | ||
if (!valid || !parts.length) | ||
if (!emptyStatement && (!valid || !parts.length)) | ||
throw Error('decypher.Query.' + methodName + ': first parameter should not be falsy or empty.'); | ||
// Filtering falsy parts in case of empty query | ||
parts = parts.filter(function(part) { | ||
return part; | ||
}); | ||
// Solving objects as relationship patterns | ||
@@ -180,3 +189,3 @@ parts = parts.map(function(part) { | ||
if (statement) | ||
string += statement + ' '; | ||
string += statement + (parts.length ? ' ' : ''); | ||
@@ -183,0 +192,0 @@ if (inner) { |
@@ -36,2 +36,3 @@ /** | ||
'ELSE', | ||
'EXPLAIN', | ||
'FOREACH', | ||
@@ -46,2 +47,3 @@ 'LIMIT', | ||
'ORDER BY', | ||
'PROFILE', | ||
'REMOVE', | ||
@@ -62,2 +64,15 @@ 'RETURN', | ||
var emptyStatements = [ | ||
'EXPLAIN', | ||
'PROFILE', | ||
'UNION', | ||
'UNION ALL' | ||
]; | ||
var EMPTY_STATEMENTS = {}; | ||
emptyStatements.forEach(function(statement) { | ||
EMPTY_STATEMENTS[statement] = true; | ||
}); | ||
var KEYWORDS = {}; | ||
@@ -90,2 +105,3 @@ | ||
exports.STATEMENTS = STATEMENTS; | ||
exports.EMPTY_STATEMENTS = EMPTY_STATEMENTS; | ||
exports.KEYWORDS = KEYWORDS; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33887
764