wao 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/cjs/tao.js +10 -3
  2. package/esm/tao.js +8 -6
  3. package/package.json +1 -1
package/cjs/tao.js CHANGED
@@ -31,10 +31,14 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
31
31
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
32
32
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
33
33
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
34
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
35
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
36
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
37
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
34
38
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
35
39
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
36
40
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
37
- var log = "\nlocal json = require(\"json\")\nao = ao or {}\n\nfunction ao.log(txt)\n if type(txt) == 'table' then\n txt = json.encode(txt)\n end\n if type(ao.outbox.Output) == 'string' then\n ao.outbox.Output = {ao.outbox.Output}\n end\n table.insert(ao.outbox.Output, txt)\n ao.outbox.Logs = ao.outbox.Logs or {}\n table.insert(ao.outbox.Logs, txt)\nend\n\nfunction ao.result(result)\n if ao.outbox.Error or result.Error then\n return { Error = result.Error or ao.outbox.Error, Output = ao.outbox.Logs }\n end\n return {\n Output = ao.outbox.Logs or result.Output or ao.outbox.Output,\n Messages = ao.outbox.Messages,\n Spawns = ao.outbox.Spawns,\n Assignments = ao.outbox.Assignments,\n }\nend\n";
41
+ var log = "\nlocal json = require(\"json\")\nao = ao or {}\n\nfunction ao.log(...)\n local args = {...}\n local txt = json.encode(args)\n if type(ao.outbox.Output) == 'string' then\n ao.outbox.Output = {ao.outbox.Output}\n end\n table.insert(ao.outbox.Output, txt)\n ao.outbox.Logs = ao.outbox.Logs or {}\n table.insert(ao.outbox.Logs, txt)\nend\n\nfunction ao.result(result)\n if ao.outbox.Error or result.Error then\n return { Error = result.Error or ao.outbox.Error, Output = ao.outbox.Logs }\n end\n return {\n Output = ao.outbox.Logs or result.Output or ao.outbox.Output,\n Messages = ao.outbox.Messages,\n Spawns = ao.outbox.Spawns,\n Assignments = ao.outbox.Assignments,\n }\nend\n";
38
42
  var renderLogs = function renderLogs(logs) {
39
43
  if ((0, _ramda.is)(Array, logs) && logs.length > 0) {
40
44
  var _iterator = _createForOfIteratorHelper(logs),
@@ -44,10 +48,13 @@ var renderLogs = function renderLogs(logs) {
44
48
  var v = _step.value;
45
49
  var l = v;
46
50
  try {
51
+ var _console;
47
52
  var p = JSON.parse(v);
48
53
  if (JSON.stringify(p) === v) l = p;
49
- } catch (e) {}
50
- console.log(l);
54
+ (_console = console).log.apply(_console, _toConsumableArray(l));
55
+ } catch (e) {
56
+ console.log(l);
57
+ }
51
58
  }
52
59
  } catch (err) {
53
60
  _iterator.e(err);
package/esm/tao.js CHANGED
@@ -10,10 +10,9 @@ let log = `
10
10
  local json = require("json")
11
11
  ao = ao or {}
12
12
 
13
- function ao.log(txt)
14
- if type(txt) == 'table' then
15
- txt = json.encode(txt)
16
- end
13
+ function ao.log(...)
14
+ local args = {...}
15
+ local txt = json.encode(args)
17
16
  if type(ao.outbox.Output) == 'string' then
18
17
  ao.outbox.Output = {ao.outbox.Output}
19
18
  end
@@ -42,11 +41,14 @@ const renderLogs = logs => {
42
41
  try {
43
42
  const p = JSON.parse(v)
44
43
  if (JSON.stringify(p) === v) l = p
45
- } catch (e) {}
46
- console.log(l)
44
+ console.log(...l)
45
+ } catch (e) {
46
+ console.log(l)
47
+ }
47
48
  }
48
49
  }
49
50
  }
51
+
50
52
  class AO extends MAO {
51
53
  constructor(opt = {}) {
52
54
  super({ ...opt, in_memory: true })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",