How to use the fxjs.reject 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 / ljoin.js View on Github external
function recur([left, results]) {
          if (reject(r=>r, results).length) return ;
          return go(
            left.rels,
            cmap(async function(me) {
              const f_key_ids = uniq(filter((r) => !!r, pluck(me.left_key, results)));
              if (me.rel_type == '-' || !f_key_ids.length) return recur([me, cat(map(r => r._ ? r._[me.as] : null, results))]);
              return go(
                (!me.left_join_over && me.left_joins.length ?
                  left_join_query : where_in_query)(me, SQL `WHERE ${IN(me.as + '.' + me.key, f_key_ids)}`, QUERY),
                group_by((v) => v[me.key]),
                function(groups) {
                  each(function(result) {
                    result._ = result._ || {};
                    result._[me.as] = (groups[result[me.left_key]] || []);
                  }, results);
                  return recur([me, cat(map(r => r._ ? r._[me.as] : null, results))]);
                }
github marpple / FxSQL / src / index.js View on Github external
return tag(function() {
      let i = 0;
      const text = Object.keys(obj).map(k => `${columnize(k)} = ${to_q()}`).join(sep);
      const values = Object.values(obj);
      return {
        text: text.replace(reg_q, function() {
          const value = values[i++];
          return is_column(value) ? value().text : to_q()
        }),
        values: reject(is_column, values)
      };
    });
  }