<commit_before>#!/usr/bin/env node

const path = require("path");
const dockerLambda = require("docker-lambda");
const pkg = require("package.json");

console.log(pkg);
<commit_msg>added wrapper function to call the bin from within node<commit_after>#!/usr/bin/env node

const path = require("path");
const dockerLambda = require("docker-lambda");
const pkg = require("./package.json");
const shell = require("shelljs");

module.exports = function (outputStats) {
  let res = shell.exec("./bin/invoke-docker-lambda", {
    silent: true
  });
  
  if (res.code == 1) {
    // remove any stderr icons
    let err = res.stderr.split("\n").slice(0, -1).map(e => e.replace(/[ℹ✔⚠✖]\s/, ""));
    if (outputStats) console.info(res.stderr);
    return {"error": err, "result": res.stdout};
  }

  if (outputStats) console.info(res.stderr);
  return {result: res.stdout};
}
{'fraction_non_alphanumeric': 0.1875, 'fraction_numerical': 0.003472222222222222, 'mean_word_length': 4.148809523809524, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '28196', 'n_tokens_mistral': 295, 'n_tokens_neox': 286, 'n_words': 69}