How to use the fxjs.index_by function in fxjs

To help you get started, we’ve selected a few fxjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marpple / FxSQL / src / index.js View on Github external
ERROR_WITH_SQL: false
};

const SymbolColumn = Symbol('COLUMN');
const SymbolTag = Symbol('TAG');
const SymbolInjection = Symbol('INJECTION');
const SymbolDefault = Symbol('DEFAULT');

const wrap_arr = a => Array.isArray(a) ? a : [a];
const mix = (arr1, arr2) => arr1.reduce((res, item, i) => {
  res.push(item);
  i < arr2.length && res.push(arr2[i]);
  return res;
}, []);

const uniq_index_by = curry((f, coll) => index_by(f, unique_by(f, coll)));

const first = a => a && a[0];
const last = a => a && a[a.length - 1];

const is_plain_object = obj => !!obj && typeof obj == 'object' && obj.constructor == Object;
const is_column = f => !!(f && f[SymbolColumn]);
const is_tag = f => !!(f && f[SymbolTag]);
const is_injection = query => query == SymbolInjection;

const tag = f => typeof f == 'function' ?
  Object.assign(f, { [SymbolTag]: true }) : tag(_ => f);

function BASE({
  create_pool,
  end_pool,
  query_fn,