Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getValue = dataType => value => {
return r.branch(
r.eq(dataType, 'INT'), value('intValue'),
r.eq(dataType, 'STRING'), value('stringValue'),
r.eq(dataType, 'FLOAT'), value('floatValue'),
r.eq(dataType, 'BYTES'), value('bytesValue'),
r.eq(dataType, 'LOCATION'), value('locationValue'),
value('bytesValue') // if dataType is unknown, use bytesValue
)
}
const getValue = dataType => value => {
return r.branch(
r.eq(dataType, 'INT'), value('intValue'),
r.eq(dataType, 'STRING'), value('stringValue'),
r.eq(dataType, 'FLOAT'), value('floatValue'),
r.eq(dataType, 'BYTES'), value('bytesValue'),
r.eq(dataType, 'LOCATION'), value('locationValue'),
value('bytesValue') // if dataType is unknown, use bytesValue
)
}
const getValue = dataType => value => {
return r.branch(
r.eq(dataType, 'INT'), value('intValue'),
r.eq(dataType, 'STRING'), value('stringValue'),
r.eq(dataType, 'FLOAT'), value('floatValue'),
r.eq(dataType, 'BYTES'), value('bytesValue'),
r.eq(dataType, 'LOCATION'), value('locationValue'),
value('bytesValue') // if dataType is unknown, use bytesValue
)
}
const getValue = dataType => value => {
return r.branch(
r.eq(dataType, 'INT'), value('intValue'),
r.eq(dataType, 'STRING'), value('stringValue'),
r.eq(dataType, 'FLOAT'), value('floatValue'),
r.eq(dataType, 'BYTES'), value('bytesValue'),
r.eq(dataType, 'LOCATION'), value('locationValue'),
value('bytesValue') // if dataType is unknown, use bytesValue
)
}
const each = (change) => {
const without = [];
const wrapped = internals.wrap(change, without, item, []);
let update = item;
if (without.length) {
update = update.without(without);
}
if (wrapped) {
update = update.merge(wrapped);
}
return RethinkDB.branch(RethinkDB.eq(item, null), RethinkDB.error('No document found'), update);
};
const hasAttribute = getAttr => attr => obj => r.eq(attr, getAttr(obj))
const hasName = hasAttribute(getName)
export default {
DATUM: r(1),
MAKE_ARRAY: r([]),
MAKE_OBJ: r({}),
VAR: r(x => x).args[1],
JAVASCRIPT: r.js(''),
UUID: r.uuid(),
HTTP: r.http(''),
ERROR: r.error(),
IMPLICIT_VAR: r.row,
DB: r.db(''),
TABLE: r.table(''),
GET: r({}).get(''),
GET_ALL: r({}).getAll(''),
EQ: r.eq(),
NE: r.ne(),
LT: r.lt(),
LE: r.le(),
GT: r.gt(),
GE: r.ge(),
NOT: r.not(),
ADD: r.add(),
SUB: r.sub(),
MUL: r.mul(),
DIV: r.div(),
MOD: r.mod(),
FLOOR: r.floor(),
CEIL: r.ceil(),
ROUND: r.round(),
APPEND: r([]).append(),
PREPEND: r([]).prepend(),
const hasPublicKey = key => obj => {
return r.eq(
key,
getPublicKey(obj)
)
}