@graffy/fill
Advanced tools
Comparing version 0.14.2 to 0.14.3
32
index.js
@@ -48,7 +48,15 @@ "use strict"; | ||
case 5: | ||
if (!(!value || !value.length)) { | ||
_context.next = 7; | ||
break; | ||
} | ||
return _context.abrupt("return", null); | ||
case 7: | ||
budget = MAX_RECURSIONS; | ||
case 6: | ||
case 8: | ||
if (!(budget-- > 0)) { | ||
_context.next = 17; | ||
_context.next = 19; | ||
break; | ||
@@ -61,10 +69,10 @@ } | ||
if (unknown) { | ||
_context.next = 11; | ||
_context.next = 13; | ||
break; | ||
} | ||
return _context.abrupt("break", 17); | ||
return _context.abrupt("break", 19); | ||
case 11: | ||
_context.next = 13; | ||
case 13: | ||
_context.next = 15; | ||
return store.call('read', unknown, { | ||
@@ -74,11 +82,11 @@ skipFill: true | ||
case 13: | ||
case 15: | ||
res = _context.sent; | ||
(0, _common.merge)(value, res); | ||
_context.next = 6; | ||
_context.next = 8; | ||
break; | ||
case 17: | ||
case 19: | ||
if (budget) { | ||
_context.next = 19; | ||
_context.next = 21; | ||
break; | ||
@@ -89,6 +97,6 @@ } | ||
case 19: | ||
case 21: | ||
return _context.abrupt("return", value); | ||
case 20: | ||
case 22: | ||
case "end": | ||
@@ -95,0 +103,0 @@ return _context.stop(); |
@@ -5,3 +5,3 @@ { | ||
"author": "aravind (https://github.com/aravindet)", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"main": "index.js", | ||
@@ -17,5 +17,5 @@ "source": "src/index.js", | ||
"@babel/runtime-corejs3": "^7.8.4", | ||
"@graffy/common": "0.14.2", | ||
"@graffy/stream": "0.14.2" | ||
"@graffy/common": "0.14.3", | ||
"@graffy/stream": "0.14.3" | ||
} | ||
} |
@@ -11,2 +11,3 @@ import { merge, slice } from '@graffy/common'; | ||
if (options.skipFill) return value; | ||
if (!value || !value.length) return null; | ||
@@ -24,2 +25,3 @@ let budget = MAX_RECURSIONS; | ||
if (!budget) throw new Error('fill.max_recursion'); | ||
// console.log('Read', debug(query), 'returned', debug(value)); | ||
return value; | ||
@@ -26,0 +28,0 @@ }); |
@@ -1,9 +0,10 @@ | ||
import { merge, slice, sieve, add } from '@graffy/common'; | ||
import { merge, slice, sieve, add, finalize } from '@graffy/common'; | ||
import { makeStream } from '@graffy/stream'; | ||
export default function subscribe(store, originalQuery, raw) { | ||
const empty = () => finalize([], originalQuery, 0); | ||
let push, end; | ||
let upstream; | ||
let query = []; | ||
let data = []; | ||
let data = empty(); | ||
let payload = []; | ||
@@ -43,3 +44,3 @@ | ||
} | ||
value = slice(value, unknown).known; | ||
value = value && slice(value, unknown).known; | ||
putValue(value, false); | ||
@@ -66,4 +67,11 @@ } catch (e) { | ||
if (value === null) { | ||
// No results exist at this moment. | ||
data = empty(); | ||
push(null); | ||
return; | ||
} | ||
if (isChange) { | ||
// console.log('Data before sieve', debug(data)); | ||
// console.log('Data before sieve', debug(data), debug(value)); | ||
const sieved = sieve(data, value); | ||
@@ -81,3 +89,3 @@ // console.log('Data after sieve', debug(data)); | ||
let { known, unknown, extraneous } = slice(data, originalQuery); | ||
data = known || []; | ||
data = known || empty(); | ||
@@ -84,0 +92,0 @@ // console.log('After slice', debug(data), unknown && debug(unknown)); |
@@ -21,6 +21,10 @@ "use strict"; | ||
function subscribe(store, originalQuery, raw) { | ||
var empty = function empty() { | ||
return (0, _common.finalize)([], originalQuery, 0); | ||
}; | ||
var push, end; | ||
var upstream; | ||
var query = []; | ||
var data = []; | ||
var data = empty(); | ||
var payload = []; | ||
@@ -87,3 +91,3 @@ resubscribe(originalQuery); | ||
case 14: | ||
value = (0, _sliceInstanceProperty(_common))(value, unknown).known; | ||
value = value && (0, _sliceInstanceProperty(_common))(value, unknown).known; | ||
putValue(value, false); | ||
@@ -217,4 +221,11 @@ _context.next = 21; | ||
if (value === null) { | ||
// No results exist at this moment. | ||
data = empty(); | ||
push(null); | ||
return; | ||
} | ||
if (isChange) { | ||
// console.log('Data before sieve', debug(data)); | ||
// console.log('Data before sieve', debug(data), debug(value)); | ||
var sieved = (0, _common.sieve)(data, value); // console.log('Data after sieve', debug(data)); | ||
@@ -235,3 +246,3 @@ | ||
data = known || []; // console.log('After slice', debug(data), unknown && debug(unknown)); | ||
data = known || empty(); // console.log('After slice', debug(data), unknown && debug(unknown)); | ||
// console.log('Payload and value', debug(payload), value && debug(value)); | ||
@@ -238,0 +249,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
16606
434
+ Added@graffy/common@0.14.3(transitive)
+ Added@graffy/stream@0.14.3(transitive)
- Removed@graffy/common@0.14.2(transitive)
- Removed@graffy/stream@0.14.2(transitive)
Updated@graffy/common@0.14.3
Updated@graffy/stream@0.14.3