Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get: function getterComputedQueries() {
// If dbsetup does not exist, throw Error!
if (!this.$dbsetup) throw new Error('[VuePouchDB] dbsetup does not exist!');
// Setting up the Queries
// TODO: memoize/cache this function
return (this.$bucket.state[this.$dbsetup.name] || []).filter(
sift(expand(queries[name], this) || {})
);
},
// When setting wait 500ms before executing the function
_validateWithRule(rule) {
// Clone where as we will be modifying the leaf nodes
let where = _.cloneDeep(rule.where);
// Fill the props
this._fillWhere(where);
// Validation failed?
let sifted = sift(where, [this._props]);
if (sifted.length > 0) {
return this._fillErrorProps(rule.error);
}
}
}
return valueFilter(val, options, populateOptions);
}
for (let i = 0; i < docs.length; ++i) {
const existingVal = utils.getValue(o.path, docs[i]);
if (existingVal == null && !getVirtual(o.originalModel.schema, o.path)) {
continue;
}
let valueToSet;
if (count) {
valueToSet = numDocs(rawIds[i]);
} else if (Array.isArray(o.match)) {
valueToSet = Array.isArray(rawIds[i]) ?
sift(o.match[i], rawIds[i]) :
sift(o.match[i], [rawIds[i]])[0];
} else {
valueToSet = rawIds[i];
}
// If we're populating a map, the existing value will be an object, so
// we need to transform again
const originalSchema = o.originalModel.schema;
const isDoc = get(docs[i], '$__', null) != null;
let isMap = isDoc ?
existingVal instanceof Map :
utils.isPOJO(existingVal);
// If we pass the first check, also make sure the local field's schematype
// is map (re: gh-6460)
isMap = isMap && get(originalSchema._getSchema(o.path), '$isSchemaMap');
if (!o.isVirtual && isMap) {
return valueFilter(val, options, populateOptions);
}
for (let i = 0; i < docs.length; ++i) {
const existingVal = utils.getValue(o.path, docs[i]);
if (existingVal == null && !getVirtual(o.originalModel.schema, o.path)) {
continue;
}
let valueToSet;
if (count) {
valueToSet = numDocs(rawIds[i]);
} else if (Array.isArray(o.match)) {
valueToSet = Array.isArray(rawIds[i]) ?
sift(o.match[i], rawIds[i]) :
sift(o.match[i], [rawIds[i]])[0];
} else {
valueToSet = rawIds[i];
}
// If we're populating a map, the existing value will be an object, so
// we need to transform again
const originalSchema = o.originalModel.schema;
const isDoc = get(docs[i], '$__', null) != null;
let isMap = isDoc ?
existingVal instanceof Map :
utils.isPOJO(existingVal);
// If we pass the first check, also make sure the local field's schematype
// is map (re: gh-6460)
isMap = isMap && get(originalSchema._getSchema(o.path), '$isSchemaMap');
if (!o.isVirtual && isMap) {
const _keys = existingVal instanceof Map ?
/* eslint-disable no-use-before-define */
import sift from 'sift';
sift.use({
$comment: () => true
});
const match = filter => actual => sift(filter, [actual]).length > 0;
export default match;
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
return data && data[0];
import update from 'react/lib/update';
import sift from 'sift';
import eventEmitter from 'event-emitter';
let idProperty = 'id';
sift.useOperator('id', (a, b) => a === b[idProperty]);
sift.useOperator('limit', () => true);
sift.useOperator('skip', () => true);
const ee = eventEmitter();
let storage = {};
function setState(state) {
storage = update(storage, {$merge: state});
Object.keys(state).forEach(key => ee.emit('change', key));
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
return data && data[0];
}
constructor(collection, query, options) {
this.collection = collection;
if (!query)
query = {};
if (!options)
options = {};
if (!options.includePendingDeletes)
query.__pendingDelete = { $exists: false };
this._query = query;
this.query = sift(query);
}