diff --git a/index.js b/index.js index 0088c6e..57983de 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -!function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){"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)}e.r(r),e.d(r,"Table",(function(){return o})),e.d(r,"Nodule",(function(){return a})),e.d(r,"FilterNodule",(function(){return h})),e.d(r,"JoinNodule",(function(){return j})),e.d(r,"TransformNodule",(function(){return L}));var o=function t(r){var e=this;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),this.getProperties=function(){return{id:e.id,label:e.label,rows:e.rows,type:e.type,isValid:e.isValid}},this.export=function(){return e.rows},this.setRows=function(t){var r=e._validateRows(t);if("ERR"===r.status)throw r;Array.isArray(t)?e.rows=t:e.rows=[t]},this._assignProps=function(t){e.id=t.id,e.label=t.label,e.type="Table",e.isValid=!0,t.rows?e.setRows(t.rows):e.rows=[]},this._validateConstructionProps=function(t){var r={status:"ERR",error:{label:"Error Creating Table",messages:[]}};return t?(t.id||r.error.messages.push("No id on creation of Table"),t.label||r.error.messages.push("No label on creation of Table"),0===r.error.messages.length?{status:"OK"}:r):(r.error.messages.push("No props on creation of Table"),r)},this._validateRows=function(t){var r={status:"ERR",error:{label:"Error Creating Table",messages:[]}},e=[];0===(e=Array.isArray(t)?t:[t]).length&&r.error.messages.push("No Tables imported");for(var o=0;o0?r:{status:"OK"}};var o=this._validateConstructionProps(r);if("ERR"===o.status)throw o;this._assignProps(r)};var a=function t(r){var e=this;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),this.asTable=function(){if(!e.export)return null;try{return new o({id:e.id,label:e.label,rows:e.export()})}catch(t){throw t}},this.getProperties=function(){var t=[];return t=Array.isArray(e.tables)?0===e.tables.length?[]:e.tables.map((function(t){return t.getProperties()})):[],{id:e.id,label:e.label,type:e.type,tables:t,isValid:e.isValid}},this.importTables=function(t){var r=e._validateTables(t);if("ERR"===r.status)throw r;var n=[];n=Array.isArray(t)?t:[t],e.tables=n},this._assignProps=function(t){e.id=t.id,e.label=t.label,e.type="Nodule",e.isValid=!0,t.tables?e.importTables(t.tables):e.tables=[]},this._validateTables=function(t){var r={status:"ERR",error:{label:"Not all imported Tables are valid",messages:[]}},e=[];if(!t)return r.error.messages.push("No Tables imported"),r;e=Array.isArray(t)?t:[t];for(var n=0;nn.filterParams[t]}:n.filterType===i.GREATEREQUAL?e=function(r){return r[t]>=n.filterParams[t]}:n.filterType===i.LESSER?e=function(r){return r[t]0?r:{status:"OK"}},n._validateType=function(t){var r={status:"ERR",error:{label:"Filter Type is not valid",messages:[]}};return Object.values(i).indexOf(t)<0&&r.error.messages.push("Type must be one of: ".concat(Object.keys(i))),r.error.messages.length>0?r:{status:"OK"}},n._assignProps(t),n}return e}(a);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 m(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function v(t){for(var r=1;r0?r:{status:"OK"}},n._assignProps(t),n}return e}(a);function E(t){return(E="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,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],n=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(n=(i=s.next()).done)&&(e.push(i.value),!r||e.length!==r);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return e}(t,r)||function(t,r){if(!t)return;if("string"==typeof t)return _(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return _(t,r)}(t,r)||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,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0?r:{status:"OK"}},n._assignProps(t),n}return e}(a);r.default={Table:o,Nodule:a,FilterNodule:h,JoinNodule:j,TransformNodule:L}}]); \ 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)}r.r(e),r.d(e,"Table",(function(){return o})),r.d(e,"Nodule",(function(){return i})),r.d(e,"FilterNodule",(function(){return d})),r.d(e,"JoinNodule",(function(){return w})),r.d(e,"TransformNodule",(function(){return L}));var o=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.getProperties=function(){return{id:r.id,label:r.label,rows:r.rows,type:r.type,isValid:r.isValid}},this.export=function(){return r.rows},this.setRows=function(t){var e=r._validateRows(t);if("ERR"===e.status)throw e;Array.isArray(t)?r.rows=t:r.rows=[t]},this._assignProps=function(t){r.id=t.id,r.label=t.label,r.type="Table",r.isValid=!0,t.rows?r.setRows(t.rows):r.rows=[]},this._validateConstructionProps=function(t){var e={status:"ERR",error:{label:"Error Creating Table",messages:[]}};return t?(t.id||e.error.messages.push("No id on creation of Table"),t.label||e.error.messages.push("No label on creation of Table"),0===e.error.messages.length?{status:"OK"}:e):(e.error.messages.push("No props on creation of Table"),e)},this._validateRows=function(t){var e={status:"ERR",error:{label:"Error Creating Table",messages:[]}},r=[];0===(r=Array.isArray(t)?t:[t]).length&&e.error.messages.push("No Tables imported");for(var o=0;o0?e:{status:"OK"}};var o=this._validateConstructionProps(e);if("ERR"===o.status)throw o;this._assignProps(e)};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 o({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){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.importTables(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===a.GREATEREQUAL?r=function(e){return e[t]>=n.filterParams[t]}:n.filterType===a.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(a).indexOf(t)<0&&e.error.messages.push("Type must be one of: ".concat(Object.keys(a))),e.error.messages.length>0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function h(t){return(h="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 m(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 v(t){for(var e=1;e0?e:{status:"OK"}},n._assignProps(t),n}return r}(i);function E(t){return(E="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,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}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:o,Nodule:i,FilterNodule:d,JoinNodule:w,TransformNodule:L}}])})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d96ecad..6d550b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dmein", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b06e3b9..da7ca21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dmein", - "version": "0.1.1", + "version": "0.1.2", "description": "Dmein 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/webpack.config.js b/webpack.config.js index 692bfd2..b36feb2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,7 +2,14 @@ const path = require('path') module.exports = { entry: { index: path.resolve(__dirname, 'src', 'index.js') }, - output: { path: path.resolve(__dirname) }, + output: { + path: path.resolve(__dirname), + filename: 'index.js', + library: 'dmein', + libraryTarget: 'umd', + globalObject: 'this', + umdNamedDefine: true + }, module: { rules: [ {