@posva/vuefire-core
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "@posva/vuefire-core", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Shared code for vue + Firebase apps used by vuefire and vuexfire", | ||
@@ -29,3 +29,3 @@ "author": "Eduardo San Martin Morote <posva13@gmail.com>", | ||
"lint": "eslint --fix src test", | ||
"dev": "yarn run test:unit -- --watchAll" | ||
"dev": "yarn run test:unit --watchAll" | ||
}, | ||
@@ -36,13 +36,13 @@ "bugs": { | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0-0", | ||
"@babel/preset-env": "^7.4.4", | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5", | ||
"@posva/vuefire-test-helpers": "^1.1.0", | ||
"@types/jest": "^24.0.12", | ||
"@types/jest": "^24.0.15", | ||
"eslint": "^5.9.0", | ||
"eslint-plugin-vue-libs": "^3.0.0", | ||
"firebase": "^5.11.1", | ||
"jest": "^24.7.1", | ||
"typescript": "^3.4.5" | ||
"jest": "^24.8.0", | ||
"typescript": "^3.5.2" | ||
}, | ||
"gitHead": "694123cacbc447f1e7d62a07d284e019d38f76da" | ||
"gitHead": "e4c8ac5bf2c6254cf7fe1998d43ceab69572703d" | ||
} |
@@ -59,13 +59,17 @@ /** | ||
} | ||
return Object.keys(doc).reduce((tot, key) => { | ||
const [data, refs] = result | ||
for (const key in doc) { | ||
const ref = doc[key] | ||
// if it's a ref | ||
if (isRef(ref)) { | ||
tot[0][key] = oldDoc[key] || ref.path | ||
data[key] = oldDoc[key] || ref.path | ||
// TODO handle subpathes? | ||
tot[1][path + key] = ref | ||
refs[path + key] = ref | ||
} else if (Array.isArray(ref)) { | ||
// TODO handle array | ||
tot[0][key] = Array(ref.length).fill(null) | ||
extractRefs(ref, oldDoc[key], path + key + '.', [tot[0][key], tot[1]]) | ||
data[key] = Array(ref.length).fill(null) | ||
const oldArray = oldDoc[key] || [] | ||
// Items that are no longer in the array aren't going to be processed | ||
const newElements = oldArray.filter(oldRef => ref.indexOf(oldRef) !== -1) | ||
extractRefs(ref, newElements, path + key + '.', [data[key], refs]) | ||
} else if ( | ||
@@ -78,11 +82,11 @@ ref == null || | ||
) { | ||
tot[0][key] = ref | ||
data[key] = ref | ||
} else if (isObject(ref)) { | ||
tot[0][key] = {} | ||
extractRefs(ref, oldDoc[key], path + key + '.', [tot[0][key], tot[1]]) | ||
data[key] = {} | ||
extractRefs(ref, oldDoc[key], path + key + '.', [data[key], refs]) | ||
} else { | ||
tot[0][key] = ref | ||
data[key] = ref | ||
} | ||
return tot | ||
}, result) | ||
} | ||
return result | ||
} | ||
@@ -89,0 +93,0 @@ |
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
17651
517