From 9b516ce978d57feba83b24c717206af0d26b3e27 Mon Sep 17 00:00:00 2001 From: Joshua Shoemaker Date: Wed, 5 Aug 2020 17:46:57 -0500 Subject: [PATCH] fix: import for GroupByNodule --- index.js | 2 +- package.json | 2 +- src/index.js | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index cfe58e8..9b7ea10 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("dmein",[],e):"object"==typeof exports?exports.dmein=e():t.dmein=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r0?e:{status:"OK"}};var o=this._validateConstructionProps(e);if("ERR"===o.status)throw o;this._assignProps(e)}var e,r,a;return e=t,(r=[{key:"headers",get:function(){var t=this.rows;if(!Array.isArray(t)||t.length<1)return[];var e=t.length,r=49;e<50&&(r=e);var n=t.slice(0,r).map((function(t){return Object.keys(t)})).flat();return Array.from(new Set(n))}}])&&o(e.prototype,r),a&&o(e,a),t}();var i=function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.asTable=function(){if(!r.export)return null;try{return new a({id:r.id,label:r.label,rows:r.export()})}catch(t){throw t}},this.getProperties=function(){var t=[];return t=Array.isArray(r.tables)?0===r.tables.length?[]:r.tables.map((function(t){return t.getProperties()})):[],{id:r.id,label:r.label,type:r.type,tables:t,isValid:r.isValid}},this.importTables=function(t){console.log('Function importTables has been depricated, please use "setTables()"'),r.setTables(t)},this.setTables=function(t){var e=r._validateTables(t);if("ERR"===e.status)throw e;var n=[];n=Array.isArray(t)?t:[t],r.tables=n},this._assignProps=function(t){r.id=t.id,r.label=t.label,r.type="Nodule",r.isValid=!0,t.tables?r.setTables(t.tables):r.tables=[]},this._validateTables=function(t){var e={status:"ERR",error:{label:"Not all imported Tables are valid",messages:[]}},r=[];if(!t)return e.error.messages.push("No Tables imported"),e;r=Array.isArray(t)?t:[t];for(var n=0;nn.filterParams[t]}:n.filterType===s.GREATEREQUAL?r=function(e){return e[t]>=n.filterParams[t]}:n.filterType===s.LESSER?r=function(e){return e[t]0?e:{status:"OK"}},n._validateType=function(t){var e={status:"ERR",error:{label:"Filter Type is not valid",messages:[]}};return Object.values(s).indexOf(t)<0&&e.error.messages.push("Type must be one of: ".concat(Object.keys(s))),e.error.messages.length>0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function m(t){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function S(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);e.default={Table:a,Nodule:i,FilterNodule:h,JoinNodule:E,TransformNodule:D}}])})); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("dmein",[],e):"object"==typeof exports?exports.dmein=e():t.dmein=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r0?e:{status:"OK"}};var o=this._validateConstructionProps(e);if("ERR"===o.status)throw o;this._assignProps(e)}var e,r,a;return e=t,(r=[{key:"headers",get:function(){var t=this.rows;if(!Array.isArray(t)||t.length<1)return[];var e=t.length,r=49;e<50&&(r=e);var n=t.slice(0,r).map((function(t){return Object.keys(t)})).flat();return Array.from(new Set(n))}}])&&o(e.prototype,r),a&&o(e,a),t}();var i=function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.asTable=function(){if(!r.export)return null;try{return new a({id:r.id,label:r.label,rows:r.export()})}catch(t){throw t}},this.getProperties=function(){var t=[];return t=Array.isArray(r.tables)?0===r.tables.length?[]:r.tables.map((function(t){return t.getProperties()})):[],{id:r.id,label:r.label,type:r.type,tables:t,isValid:r.isValid}},this.importTables=function(t){console.log('Function importTables has been depricated, please use "setTables()"'),r.setTables(t)},this.setTables=function(t){var e=r._validateTables(t);if("ERR"===e.status)throw e;var n=[];n=Array.isArray(t)?t:[t],r.tables=n},this._assignProps=function(t){r.id=t.id,r.label=t.label,r.type="Nodule",r.isValid=!0,t.tables?r.setTables(t.tables):r.tables=[]},this._validateTables=function(t){var e={status:"ERR",error:{label:"Not all imported Tables are valid",messages:[]}},r=[];if(!t)return e.error.messages.push("No Tables imported"),e;r=Array.isArray(t)?t:[t];for(var n=0;nn.filterParams[t]}:n.filterType===u.GREATEREQUAL?r=function(e){return e[t]>=n.filterParams[t]}:n.filterType===u.LESSER?r=function(e){return e[t]0?e:{status:"OK"}},n._validateType=function(t){var e={status:"ERR",error:{label:"Filter Type is not valid",messages:[]}};return Object.values(u).indexOf(t)<0&&e.error.messages.push("Type must be one of: ".concat(Object.keys(u))),e.error.messages.length>0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function m(t){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function D(t){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function V(t,e){return(V=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function C(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=G(t);if(e){var o=G(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return K(this,r)}}function K(t,e){return!e||"object"!==D(e)&&"function"!=typeof e?F(t):e}function F(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function G(t){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var U=function(t){!function(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}}),e&&V(t,e)}(r,t);var e=C(r);function r(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(n=e.call(this,t)).asTable=function(){var t=n.export(),e=[];for(var r in t){var o={id:"".concat(n.id,"-").concat(r),label:"".concat(n.label," by ").concat(r),rows:t[r]},i=new a(o);e.push(i)}return e},n.export=function(){var t=F(n).groupByValue;return n.tables.map((function(t){return t.export()})).flat().reduce((function(e,r){var n=r[t];return e[n]=e[n]||[],e[n].push(r),e}),{})},n.setGroupByValue=function(t){var e=n._validateGroupByValue(t);if("ERR"===e.status)throw e;n.groupByValue=t},n._assignProps=function(t){t.groupByValue&&n.setGroupByValue(t.groupByValue)},n._validateGroupByValue=function(t){if("string"==typeof t)return{status:"OK"};var e=D(t);[].push("GroupBy value was of type ".concat(e,", should be a string"))},n._assignProps(t),n}return r}(i);e.default={Table:a,Nodule:i,FilterNodule:d,JoinNodule:E,TransformNodule:B,GroupByNodule:U}}])})); \ No newline at end of file diff --git a/package.json b/package.json index 77d8895..b5b00d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lovelacejs", - "version": "0.2.0", + "version": "0.2.1", "description": "Lovelace.js is a modern JavaScript Library to create objects that easily mutate data through relationships, filtering, and tranforming the shape of data.", "main": "index.js", "directories": { diff --git a/src/index.js b/src/index.js index b589062..f8d9801 100644 --- a/src/index.js +++ b/src/index.js @@ -3,13 +3,15 @@ import Nodule from './entities/Nodule.js' import FilterNodule from './entities/nodules/FilterNodule.js' import JoinNodule from './entities/nodules/JoinNodule.js' import TransformNodule from './entities/nodules/TransformNodule.js' +import GroupByNodule from './entities/nodules/GroupByNodule.js' export { Table, Nodule, FilterNodule, JoinNodule, - TransformNodule + TransformNodule, + GroupByNodule } export default { @@ -17,5 +19,6 @@ export default { Nodule, FilterNodule, JoinNodule, - TransformNodule + TransformNodule, + GroupByNodule }