fix assocPath
This commit is contained in:
parent
808952646c
commit
cab0cf243d
2 changed files with 4 additions and 3 deletions
|
@ -105,7 +105,7 @@ export const assocPath = curry((key, value, obj) => pipe(
|
||||||
makePath,
|
makePath,
|
||||||
rev,
|
rev,
|
||||||
reduce((acc, val) => ({ [val]: acc }), value),
|
reduce((acc, val) => ({ [val]: acc }), value),
|
||||||
mergeRightDeep(obj),
|
mergeLeftDeep(obj),
|
||||||
)(key))
|
)(key))
|
||||||
|
|
||||||
export const mergeRightDeep = curry((a, b) =>
|
export const mergeRightDeep = curry((a, b) =>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { defineQuery, hasComponent } from 'bitecs'
|
import { defineQuery, hasComponent } from 'bitecs'
|
||||||
import { query as q } from './query-parser/index.js'
|
import { query as q } from './query-parser/index.js'
|
||||||
import { parseAll } from './parser.js'
|
import { parseAll } from './parser.js'
|
||||||
import { curry, of, is, reduce, flip, concat, map, when, assoc, mergeLeft, isNil, path, prop, ifElse, diverge, pipe, always, assocPath, prepend, orDefault, useWith, applyTo } from './fn.js'
|
import { curry, of, is, reduce, flip, concat, map, when, assoc, mergeLeft, isNil, path, prop, ifElse, diverge, pipe, always, assocPath, prepend, orDefault, useWith, applyTo, tap } from './fn.js'
|
||||||
import { Relationship } from './query-parser/types.js'
|
import { Relationship } from './query-parser/types.js'
|
||||||
|
|
||||||
const prepareQuery = (query, component) => {
|
const prepareQuery = (query, component) => {
|
||||||
|
@ -51,7 +51,7 @@ const queryRelationship = (from, edge, to, world) => {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
const assembleQuery = (query, entities) => map(entity => of({ entity, query }), entities)
|
const assembleQuery = curry((query, entities) => map(entity => of({ entity, query }), entities))
|
||||||
|
|
||||||
const executeQuery = curry((query, world) => {
|
const executeQuery = curry((query, world) => {
|
||||||
if (!query.relationship) {
|
if (!query.relationship) {
|
||||||
|
@ -60,6 +60,7 @@ const executeQuery = curry((query, world) => {
|
||||||
|
|
||||||
const { from, to: _to, edge } = query
|
const { from, to: _to, edge } = query
|
||||||
const to = when(prop('relationship'), prop('from'), _to)
|
const to = when(prop('relationship'), prop('from'), _to)
|
||||||
|
|
||||||
const edges = queryRelationship(
|
const edges = queryRelationship(
|
||||||
{ type: from.type, results: from.query(world) },
|
{ type: from.type, results: from.query(world) },
|
||||||
{ type: edge.type, results: edge.query(world) },
|
{ type: edge.type, results: edge.query(world) },
|
||||||
|
|
Loading…
Reference in a new issue