Comparing version 1.1.0 to 1.2.0
@@ -57,3 +57,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally {try{if(!_n&&_i["return"])_i["return"]();}finally {if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value" in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _symbols=__webpack_require__(1);function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else {return Array.from(arr);}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var Dodo=function(){function Dodo(array,masks,colname){_classCallCheck(this,Dodo);this.array=array;this.masks=masks||[];this.col=colname?array.index[colname]:false;}_createClass(Dodo,[{key:'toArray',value:function toArray(){return [].concat(_toConsumableArray(this));}},{key:Symbol.iterator,value:regeneratorRuntime.mark(function value(){var _this=this;var rowObj,descs,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,i,len,j,bool,masksLen;return regeneratorRuntime.wrap(function value$(_context){while(1){switch(_context.prev=_context.next){case 0:rowObj={};descs={};_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context.prev=5;_loop=function _loop(){var colname=_step.value;descs[colname]={get:function get(){return _this.array[i][_this.array.index[colname]];}};};for(_iterator=Object.keys(this.array.index)[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){_loop();}_context.next=14;break;case 10:_context.prev=10;_context.t0=_context['catch'](5);_didIteratorError=true;_iteratorError=_context.t0;case 14:_context.prev=14;_context.prev=15;if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}case 17:_context.prev=17;if(!_didIteratorError){_context.next=20;break;}throw _iteratorError;case 20:return _context.finish(17);case 21:return _context.finish(14);case 22:Object.defineProperties(rowObj,descs);i=-1;len=this.array.length;case 25:if(!(++i<len)){_context.next=35;break;}j=-1;bool=true;masksLen=this.masks.length;while(bool&&++j<masksLen){bool=bool&&this.masks[j](rowObj);}if(!bool){_context.next=33;break;}_context.next=33;return this.array[i];case 33:_context.next=25;break;case 35:case 'end':return _context.stop();}}},value,this,[[5,10,14,22],[15,,17,21]]);})},{key:'filter',value:function filter(fn){return new Dodo(this.array,[].concat(_toConsumableArray(this.masks),[fn]));}},{key:'map',value:regeneratorRuntime.mark(function map(fn){var _iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,row,_iteratorNormalCompletion3,_didIteratorError3,_iteratorError3,_iterator3,_step3;return regeneratorRuntime.wrap(function map$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!this.col){_context2.next=29;break;}_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context2.prev=4;_iterator2=this[Symbol.iterator]();case 6:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context2.next=13;break;}row=_step2.value;_context2.next=10;return fn?fn(row[this.col]):row[this.col];case 10:_iteratorNormalCompletion2=true;_context2.next=6;break;case 13:_context2.next=19;break;case 15:_context2.prev=15;_context2.t0=_context2['catch'](4);_didIteratorError2=true;_iteratorError2=_context2.t0;case 19:_context2.prev=19;_context2.prev=20;if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}case 22:_context2.prev=22;if(!_didIteratorError2){_context2.next=25;break;}throw _iteratorError2;case 25:return _context2.finish(22);case 26:return _context2.finish(19);case 27:_context2.next=55;break;case 29:_iteratorNormalCompletion3=true;_didIteratorError3=false;_iteratorError3=undefined;_context2.prev=32;_iterator3=this[Symbol.iterator]();case 34:if(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done){_context2.next=41;break;}row=_step3.value;_context2.next=38;return fn?fn(row):row;case 38:_iteratorNormalCompletion3=true;_context2.next=34;break;case 41:_context2.next=47;break;case 43:_context2.prev=43;_context2.t1=_context2['catch'](32);_didIteratorError3=true;_iteratorError3=_context2.t1;case 47:_context2.prev=47;_context2.prev=48;if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}case 50:_context2.prev=50;if(!_didIteratorError3){_context2.next=53;break;}throw _iteratorError3;case 53:return _context2.finish(50);case 54:return _context2.finish(47);case 55:case 'end':return _context2.stop();}}},map,this,[[4,15,19,27],[20,,22,26],[32,43,47,55],[48,,50,54]]);})},{key:'uniq',value:function uniq(fn){return new Set(this.map(fn));}},{key:'count',value:function count(){var i=0;var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=this[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var _row=_step4.value;++i;}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally {try{if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return();}}finally {if(_didIteratorError4){throw _iteratorError4;}}}return i;}},{key:'groupBy',value:function groupBy(colname){var uniques=this[colname].uniq();var hash={};var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=uniques[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var val=_step5.value;hash[val]=this[colname].eq(val);}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally {try{if(!_iteratorNormalCompletion5&&_iterator5.return){_iterator5.return();}}finally {if(_didIteratorError5){throw _iteratorError5;}}}return new Flock(hash);}}]);return Dodo;}();exports.default=Dodo;var Flock=function(){function Flock(hash,prop,args){var _this2=this;_classCallCheck(this,Flock);this.hash=hash instanceof Flock?hash.hash:hash;if(prop){var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=this[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var _step6$value=_slicedToArray(_step6.value,2);var key=_step6$value[0];var perspective=_step6$value[1];this.hash[key]=args?perspective[prop].apply(perspective,_toConsumableArray(args)):perspective[prop];}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally {try{if(!_iteratorNormalCompletion6&&_iterator6.return){_iterator6.return();}}finally {if(_didIteratorError6){throw _iteratorError6;}}}}if(this[_symbols.first] instanceof Dodo){var desc={};var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{var _loop2=function _loop2(){var colname=_step7.value;desc[colname]={get:function get(){return new Flock(_this2,colname);}};};for(var _iterator7=Object.keys(this[_symbols.first].array.index)[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){_loop2();}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally {try{if(!_iteratorNormalCompletion7&&_iterator7.return){_iterator7.return();}}finally {if(_didIteratorError7){throw _iteratorError7;}}}Object.defineProperties(this,desc);}else {this.hash[Symbol.iterator]=regeneratorRuntime.mark(function _callee(){var _iteratorNormalCompletion8,_didIteratorError8,_iteratorError8,_iterator8,_step8,_step8$value,key,iter;return regeneratorRuntime.wrap(function _callee$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_iteratorNormalCompletion8=true;_didIteratorError8=false;_iteratorError8=undefined;_context3.prev=3;_iterator8=Object.entries(this)[Symbol.iterator]();case 5:if(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done){_context3.next=14;break;}_step8$value=_slicedToArray(_step8.value,2);key=_step8$value[0];iter=_step8$value[1];_context3.next=11;return [key,[].concat(_toConsumableArray(iter))];case 11:_iteratorNormalCompletion8=true;_context3.next=5;break;case 14:_context3.next=20;break;case 16:_context3.prev=16;_context3.t0=_context3['catch'](3);_didIteratorError8=true;_iteratorError8=_context3.t0;case 20:_context3.prev=20;_context3.prev=21;if(!_iteratorNormalCompletion8&&_iterator8.return){_iterator8.return();}case 23:_context3.prev=23;if(!_didIteratorError8){_context3.next=26;break;}throw _iteratorError8;case 26:return _context3.finish(23);case 27:return _context3.finish(20);case 28:case 'end':return _context3.stop();}}},_callee,this,[[3,16,20,28],[21,,23,27]]);});return this.hash;}}_createClass(Flock,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function value(){return regeneratorRuntime.wrap(function value$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.delegateYield(Object.entries(this.hash),'t0',1);case 1:case 'end':return _context4.stop();}}},value,this);})},{key:_symbols.first,get:function get(){return this[Symbol.iterator]().next().value[1];}}]);return Flock;}();var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{var _loop3=function _loop3(){var method=_step9.value;if(!(method in Flock.prototype))Flock.prototype[method]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return new Flock(this,method,args);};};for(var _iterator9=Object.getOwnPropertyNames(Dodo.prototype)[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){_loop3();}}catch(err){_didIteratorError9=true;_iteratorError9=err;}finally {try{if(!_iteratorNormalCompletion9&&_iterator9.return){_iterator9.return();}}finally {if(_didIteratorError9){throw _iteratorError9;}}} | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally {try{if(!_n&&_i["return"])_i["return"]();}finally {if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value" in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _symbols=__webpack_require__(1);function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else {return Array.from(arr);}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var Dodo=function(){function Dodo(array,masks,colname){_classCallCheck(this,Dodo);this.array=array;this.masks=masks||[];this.col=colname?array.index[colname]:false;}_createClass(Dodo,[{key:'toArray',value:function toArray(){return [].concat(_toConsumableArray(this));}},{key:Symbol.iterator,value:regeneratorRuntime.mark(function value(){var _this=this;var desc,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_loop,_iterator,_step,rowObj,i,len,j,bool,masksLen;return regeneratorRuntime.wrap(function value$(_context){while(1){switch(_context.prev=_context.next){case 0:desc={};_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context.prev=4;_loop=function _loop(){var colname=_step.value;desc[colname]={get:function get(){return _this.array[i][_this.array.index[colname]];}};};for(_iterator=Object.keys(this.array.index)[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){_loop();}_context.next=13;break;case 9:_context.prev=9;_context.t0=_context['catch'](4);_didIteratorError=true;_iteratorError=_context.t0;case 13:_context.prev=13;_context.prev=14;if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}case 16:_context.prev=16;if(!_didIteratorError){_context.next=19;break;}throw _iteratorError;case 19:return _context.finish(16);case 20:return _context.finish(13);case 21:rowObj=Object.defineProperties({},desc);i=-1;len=this.array.length;case 24:if(!(++i<len)){_context.next=34;break;}j=-1;bool=true;masksLen=this.masks.length;while(bool&&++j<masksLen){bool=bool&&this.masks[j](rowObj);}if(!bool){_context.next=32;break;}_context.next=32;return this.array[i];case 32:_context.next=24;break;case 34:case 'end':return _context.stop();}}},value,this,[[4,9,13,21],[14,,16,20]]);})},{key:'filter',value:function filter(fn){return new Dodo(this.array,[].concat(_toConsumableArray(this.masks),[fn]));}},{key:'map',value:regeneratorRuntime.mark(function map(fn){var _this2=this;var desc,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_loop2,_iterator2,_step2,rowObj,i,_iteratorNormalCompletion3,_didIteratorError3,_iteratorError3,_iterator3,_step3,row;return regeneratorRuntime.wrap(function map$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:desc={};_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context2.prev=4;_loop2=function _loop2(){var colname=_step2.value;desc[colname]={get:function get(){return _this2.array[i][_this2.array.index[colname]];}};};for(_iterator2=Object.keys(this.array.index)[Symbol.iterator]();!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){_loop2();}_context2.next=13;break;case 9:_context2.prev=9;_context2.t0=_context2['catch'](4);_didIteratorError2=true;_iteratorError2=_context2.t0;case 13:_context2.prev=13;_context2.prev=14;if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}case 16:_context2.prev=16;if(!_didIteratorError2){_context2.next=19;break;}throw _iteratorError2;case 19:return _context2.finish(16);case 20:return _context2.finish(13);case 21:rowObj=Object.defineProperties({},desc);i=-1;_iteratorNormalCompletion3=true;_didIteratorError3=false;_iteratorError3=undefined;_context2.prev=26;_iterator3=this[Symbol.iterator]();case 28:if(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done){_context2.next=36;break;}row=_step3.value;++i;_context2.next=33;return fn(rowObj);case 33:_iteratorNormalCompletion3=true;_context2.next=28;break;case 36:_context2.next=42;break;case 38:_context2.prev=38;_context2.t1=_context2['catch'](26);_didIteratorError3=true;_iteratorError3=_context2.t1;case 42:_context2.prev=42;_context2.prev=43;if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}case 45:_context2.prev=45;if(!_didIteratorError3){_context2.next=48;break;}throw _iteratorError3;case 48:return _context2.finish(45);case 49:return _context2.finish(42);case 50:case 'end':return _context2.stop();}}},map,this,[[4,9,13,21],[14,,16,20],[26,38,42,50],[43,,45,49]]);})},{key:'uniq',value:function uniq(fn){return new Set(this.map(fn));}},{key:'count',value:function count(){var i=0;var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=this[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var _row=_step4.value;++i;}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally {try{if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return();}}finally {if(_didIteratorError4){throw _iteratorError4;}}}return i;}},{key:'group',value:function group(colname){var _this3=this;var uniques=this.uniq(function(d){return d[colname];});var hash={};var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{var _loop3=function _loop3(){var val=_step5.value;hash[val]=_this3.filter(function(d){return d[colname]==val;});};for(var _iterator5=uniques[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){_loop3();}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally {try{if(!_iteratorNormalCompletion5&&_iterator5.return){_iterator5.return();}}finally {if(_didIteratorError5){throw _iteratorError5;}}}return new Flock(hash);}}]);return Dodo;}();exports.default=Dodo;var Flock=function(){function Flock(hash,prop,args){var _this4=this;_classCallCheck(this,Flock);this.hash=hash instanceof Flock?hash.hash:hash;if(prop){var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=this[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var _step6$value=_slicedToArray(_step6.value,2);var key=_step6$value[0];var perspective=_step6$value[1];this.hash[key]=args?perspective[prop].apply(perspective,_toConsumableArray(args)):perspective[prop];}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally {try{if(!_iteratorNormalCompletion6&&_iterator6.return){_iterator6.return();}}finally {if(_didIteratorError6){throw _iteratorError6;}}}}if(this[_symbols.first] instanceof Dodo){var desc={};var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{var _loop4=function _loop4(){var colname=_step7.value;desc[colname]={get:function get(){return new Flock(_this4,colname);}};};for(var _iterator7=Object.keys(this[_symbols.first].array.index)[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){_loop4();}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally {try{if(!_iteratorNormalCompletion7&&_iterator7.return){_iterator7.return();}}finally {if(_didIteratorError7){throw _iteratorError7;}}}Object.defineProperties(this,desc);}else {this.hash[Symbol.iterator]=regeneratorRuntime.mark(function _callee(){var _iteratorNormalCompletion8,_didIteratorError8,_iteratorError8,_iterator8,_step8,_step8$value,key,iter;return regeneratorRuntime.wrap(function _callee$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_iteratorNormalCompletion8=true;_didIteratorError8=false;_iteratorError8=undefined;_context3.prev=3;_iterator8=Object.entries(this)[Symbol.iterator]();case 5:if(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done){_context3.next=14;break;}_step8$value=_slicedToArray(_step8.value,2);key=_step8$value[0];iter=_step8$value[1];_context3.next=11;return [key,[].concat(_toConsumableArray(iter))];case 11:_iteratorNormalCompletion8=true;_context3.next=5;break;case 14:_context3.next=20;break;case 16:_context3.prev=16;_context3.t0=_context3['catch'](3);_didIteratorError8=true;_iteratorError8=_context3.t0;case 20:_context3.prev=20;_context3.prev=21;if(!_iteratorNormalCompletion8&&_iterator8.return){_iterator8.return();}case 23:_context3.prev=23;if(!_didIteratorError8){_context3.next=26;break;}throw _iteratorError8;case 26:return _context3.finish(23);case 27:return _context3.finish(20);case 28:case 'end':return _context3.stop();}}},_callee,this,[[3,16,20,28],[21,,23,27]]);});return this.hash;}}_createClass(Flock,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function value(){return regeneratorRuntime.wrap(function value$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.delegateYield(Object.entries(this.hash),'t0',1);case 1:case 'end':return _context4.stop();}}},value,this);})},{key:_symbols.first,get:function get(){return this[Symbol.iterator]().next().value[1];}}]);return Flock;}();var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{var _loop5=function _loop5(){var method=_step9.value;if(!(method in Flock.prototype))Flock.prototype[method]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return new Flock(this,method,args);};};for(var _iterator9=Object.getOwnPropertyNames(Dodo.prototype)[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){_loop5();}}catch(err){_didIteratorError9=true;_iteratorError9=err;}finally {try{if(!_iteratorNormalCompletion9&&_iterator9.return){_iterator9.return();}}finally {if(_didIteratorError9){throw _iteratorError9;}}} | ||
@@ -60,0 +60,0 @@ /***/ }, |
{ | ||
"name": "dodos", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Pandas-inspired iterator-based data wrangling library for js", | ||
@@ -5,0 +5,0 @@ "main": "dist/dodos.js", |
@@ -13,7 +13,6 @@ import {first} from './symbols' | ||
*[Symbol.iterator]() { | ||
const rowObj = {} | ||
let descs = {} | ||
let desc = {} | ||
for (const colname of Object.keys(this.array.index)) | ||
descs[colname] = {get: () => this.array[i][this.array.index[colname]]} | ||
Object.defineProperties(rowObj, descs) | ||
desc[colname] = {get: () => this.array[i][this.array.index[colname]]} | ||
const rowObj = Object.defineProperties({}, desc) | ||
@@ -36,8 +35,13 @@ let i = -1 | ||
*map(fn) { | ||
if (this.col) | ||
for (const row of this) | ||
yield fn ? fn(row[this.col]) : row[this.col] | ||
else | ||
for (const row of this) | ||
yield fn ? fn(row) : row | ||
// TODO: implement same magic as the filter | ||
let desc = {} | ||
for (const colname of Object.keys(this.array.index)) | ||
desc[colname] = {get: () => this.array[i][this.array.index[colname]]} | ||
const rowObj = Object.defineProperties({}, desc) | ||
let i = -1 | ||
for (const row of this) { // eslint-disable-line no-unused-vars | ||
++i | ||
yield fn(rowObj) | ||
} | ||
} | ||
@@ -54,7 +58,7 @@ | ||
groupBy(colname) { | ||
const uniques = this[colname].uniq() | ||
group(colname) { | ||
const uniques = this.uniq(d => d[colname]) | ||
let hash = {} | ||
for (const val of uniques) { | ||
hash[val] = this[colname].eq(val) | ||
hash[val] = this.filter(d => d[colname] == val) | ||
} | ||
@@ -61,0 +65,0 @@ return new Flock(hash) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72778
364