Comparing version 8.9.0 to 8.9.1
@@ -9,2 +9,3 @@ 'use strict'; | ||
const Geo = require('./geo'); | ||
const Special = require('./special'); | ||
@@ -25,3 +26,3 @@ | ||
if (typeof criteria === 'function' && | ||
if (Special.isSpecial(criteria) && | ||
criteria.type === 'by') { | ||
@@ -67,3 +68,3 @@ | ||
if (typeof value !== 'function') { | ||
if (!Special.isSpecial(value)) { | ||
const condition = (options.match ? row.match(internals.match(value, options.match)) : row.eq(value)); | ||
@@ -127,4 +128,5 @@ tests.push(condition.default(null)); | ||
const orValue = value.value[j]; | ||
if (typeof orValue === 'function') { | ||
if (Special.isSpecial(orValue)) { | ||
Hoek.assert(['unset', 'is', 'empty'].indexOf(orValue.type) !== -1, `Unknown or criteria value type ${orValue.type}`); | ||
if (orValue.type === 'unset') { | ||
@@ -197,3 +199,3 @@ ors.push(exports.row(path.slice(0, -1)).hasFields(path[path.length - 1]).not()); | ||
if (typeof criteria === 'function') { | ||
if (Special.isSpecial(criteria)) { | ||
return [{ value: criteria }]; | ||
@@ -209,3 +211,5 @@ } | ||
if (typeof value === 'object') { | ||
if (typeof value === 'object' && | ||
!Special.isSpecial(value)) { | ||
edges.push(location); | ||
@@ -212,0 +216,0 @@ lines = lines.concat(internals.flatten(value, location, edges)); |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const Id = require('./id'); | ||
const Special = require('./special'); | ||
const Table = require('./table'); | ||
@@ -497,3 +498,3 @@ const Unique = require('./unique'); | ||
return internals.special('or', values); | ||
return new Special('or', values); | ||
} | ||
@@ -503,3 +504,3 @@ | ||
return internals.special('contains', values, options); | ||
return new Special('contains', values, options); | ||
} | ||
@@ -509,3 +510,3 @@ | ||
return internals.special('match', values, options); | ||
return new Special('match', values, options); | ||
} | ||
@@ -515,3 +516,3 @@ | ||
return internals.special('near', coordinates, { distance, unit }); | ||
return new Special('near', coordinates, { distance, unit }); | ||
} | ||
@@ -521,3 +522,3 @@ | ||
return internals.special('or', [].concat(values), { not: true }); | ||
return new Special('or', [].concat(values), { not: true }); | ||
} | ||
@@ -547,3 +548,3 @@ | ||
return internals.special('is', value, flags); | ||
return new Special('is', value, flags); | ||
} | ||
@@ -553,3 +554,3 @@ | ||
return internals.special('by', [].concat(values), { index }); | ||
return new Special('by', [].concat(values), { index }); | ||
} | ||
@@ -559,3 +560,3 @@ | ||
return internals.special('empty'); | ||
return new Special('empty'); | ||
} | ||
@@ -567,3 +568,3 @@ | ||
return internals.special('unset'); | ||
return new Special('unset'); | ||
} | ||
@@ -575,3 +576,3 @@ | ||
return internals.special('increment', value); | ||
return new Special('increment', value); | ||
} | ||
@@ -598,3 +599,3 @@ | ||
return internals.special('append', value, options); | ||
return new Special('append', value, options); | ||
} | ||
@@ -604,3 +605,3 @@ | ||
return internals.special('override', value); | ||
return new Special('override', value); | ||
} | ||
@@ -677,18 +678,2 @@ }; | ||
internals.special = function (type, value, options) { | ||
options = options || {}; | ||
const special = function () { }; // Return function because 1. typeof fastest 2. illegal database type | ||
special.type = type; | ||
special.flags = Hoek.clone(options); | ||
if (value !== undefined) { | ||
special.value = value; | ||
} | ||
return special; | ||
}; | ||
internals.empty = function (results) { | ||
@@ -695,0 +680,0 @@ |
@@ -8,3 +8,5 @@ 'use strict'; | ||
const Special = require('./special'); | ||
// Declare internals | ||
@@ -69,3 +71,3 @@ | ||
if (typeof field !== 'function' || | ||
if (!Special.isSpecial(field) || | ||
field.type !== 'near') { | ||
@@ -72,0 +74,0 @@ |
@@ -8,3 +8,5 @@ 'use strict'; | ||
const Special = require('./special'); | ||
// Declare internals | ||
@@ -68,4 +70,3 @@ | ||
if (typeof changes === 'function') { | ||
if (Special.isSpecial(changes)) { | ||
const { type, value, flags } = changes; | ||
@@ -72,0 +73,0 @@ |
@@ -8,3 +8,5 @@ 'use strict'; | ||
const Special = require('./special'); | ||
// Declare internals | ||
@@ -46,3 +48,3 @@ | ||
exports.reserve = async function (table, items, updateId, callback) { | ||
exports.reserve = async function (table, items, updateId) { | ||
@@ -196,3 +198,5 @@ if (!table._unique) { | ||
if (typeof ref === 'object') { | ||
if (typeof ref === 'object' && | ||
!Special.isSpecial(ref)) { | ||
const keys = Object.keys(ref); | ||
@@ -202,3 +206,3 @@ let unset = false; | ||
if (typeof ref[key] !== 'function') { | ||
if (!Special.isSpecial(ref[key])) { | ||
return true; | ||
@@ -218,3 +222,3 @@ } | ||
if (typeof ref === 'function') { | ||
if (Special.isSpecial(ref)) { | ||
if (ref.type === 'unset') { | ||
@@ -221,0 +225,0 @@ return []; |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "8.9.0", | ||
"version": "8.9.1", | ||
"repository": "git://github.com/hueniverse/penseur", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
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
76961
15
1909