How to use the fxjs.min_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
function ASSOCIATE_MODULE(strs, ...tails) {
    strs = strs.slice();
    strs.push(strs.pop() + '\n');
    var [strs2, tails2] = import_module(strs, tails);

    const splited = deep_flat(strs.map(str => str.split('\n')))
      .filter(str => str.match(/^\s*/)[0])
      .filter(str => str.trim());

    const min = min_by(str => str.match(/^\s*/)[0].length, splited);
    const a = '\n' + min.match(/^\s*/)[0];

    return [strs2.map(str => str.split(a).join('\n')), tails2];
  }