Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dodos

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dodos - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

.nyc_output/64238.json

10

dist/dodos.js

@@ -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 _util=__webpack_require__(2);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);var desc={};var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{var _loop=function _loop(){var colname=_step.value;desc[colname]={get:function get(){return new Dodo(array,masks,colname);}};};for(var _iterator=Object.keys(array.index)[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){_loop();}}catch(err){_didIteratorError=true;_iteratorError=err;}finally {try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally {if(_didIteratorError){throw _iteratorError;}}}Object.defineProperties(this,desc);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 masks,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,row;return regeneratorRuntime.wrap(function value$(_context){while(1){switch(_context.prev=_context.next){case 0:masks=this.masks.length?(0,_util.or)(this.masks):function(){return true;};_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context.prev=4;_iterator2=this.array[Symbol.iterator]();case 6:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context.next=14;break;}row=_step2.value;if(!masks(row)){_context.next=11;break;}_context.next=11;return row;case 11:_iteratorNormalCompletion2=true;_context.next=6;break;case 14:_context.next=20;break;case 16:_context.prev=16;_context.t0=_context['catch'](4);_didIteratorError2=true;_iteratorError2=_context.t0;case 20:_context.prev=20;_context.prev=21;if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}case 23:_context.prev=23;if(!_didIteratorError2){_context.next=26;break;}throw _iteratorError2;case 26:return _context.finish(23);case 27:return _context.finish(20);case 28:case 'end':return _context.stop();}}},value,this,[[4,16,20,28],[21,,23,27]]);})},{key:_symbols.filter,value:function value(fn){return new Dodo(this.array,[].concat(_toConsumableArray(this.masks),[fn]));}},{key:'eq',value:function eq(comp){var _this=this;return this[_symbols.filter](function(row){return row[_this.col]===comp;});}},{key:'between',value:function between(down,up){var _this2=this;return this[_symbols.filter](function(row){return row[_this2.col]<=up&&row[_this2.col]>=down;});}},{key:'map',value:regeneratorRuntime.mark(function map(fn){var _iteratorNormalCompletion3,_didIteratorError3,_iteratorError3,_iterator3,_step3,_row,_iteratorNormalCompletion4,_didIteratorError4,_iteratorError4,_iterator4,_step4,_row2;return regeneratorRuntime.wrap(function map$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!this.col){_context2.next=29;break;}_iteratorNormalCompletion3=true;_didIteratorError3=false;_iteratorError3=undefined;_context2.prev=4;_iterator3=this[Symbol.iterator]();case 6:if(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done){_context2.next=13;break;}_row=_step3.value;_context2.next=10;return fn?fn(_row[this.col]):_row[this.col];case 10:_iteratorNormalCompletion3=true;_context2.next=6;break;case 13:_context2.next=19;break;case 15:_context2.prev=15;_context2.t0=_context2['catch'](4);_didIteratorError3=true;_iteratorError3=_context2.t0;case 19:_context2.prev=19;_context2.prev=20;if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}case 22:_context2.prev=22;if(!_didIteratorError3){_context2.next=25;break;}throw _iteratorError3;case 25:return _context2.finish(22);case 26:return _context2.finish(19);case 27:_context2.next=55;break;case 29:_iteratorNormalCompletion4=true;_didIteratorError4=false;_iteratorError4=undefined;_context2.prev=32;_iterator4=this[Symbol.iterator]();case 34:if(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done){_context2.next=41;break;}_row2=_step4.value;_context2.next=38;return fn?fn(_row2):_row2;case 38:_iteratorNormalCompletion4=true;_context2.next=34;break;case 41:_context2.next=47;break;case 43:_context2.prev=43;_context2.t1=_context2['catch'](32);_didIteratorError4=true;_iteratorError4=_context2.t1;case 47:_context2.prev=47;_context2.prev=48;if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return();}case 50:_context2.prev=50;if(!_didIteratorError4){_context2.next=53;break;}throw _iteratorError4;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 _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=this[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var _row3=_step5.value;++i;}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally {try{if(!_iteratorNormalCompletion5&&_iterator5.return){_iterator5.return();}}finally {if(_didIteratorError5){throw _iteratorError5;}}}return i;}},{key:'groupBy',value:function groupBy(colname){var uniques=this[colname].uniq();var hash={};var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=uniques[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var val=_step6.value;hash[val]=this[colname].eq(val);}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally {try{if(!_iteratorNormalCompletion6&&_iterator6.return){_iterator6.return();}}finally {if(_didIteratorError6){throw _iteratorError6;}}}return new Flock(hash);}}]);return Dodo;}();exports.default=Dodo;var Flock=function(){function Flock(hash,prop,args){var _this3=this;_classCallCheck(this,Flock);this.hash=hash instanceof Flock?hash.hash:hash;if(prop){var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=this[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var _step7$value=_slicedToArray(_step7.value,2);var key=_step7$value[0];var perspective=_step7$value[1];this.hash[key]=args?perspective[prop].apply(perspective,_toConsumableArray(args)):perspective[prop];}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally {try{if(!_iteratorNormalCompletion7&&_iterator7.return){_iterator7.return();}}finally {if(_didIteratorError7){throw _iteratorError7;}}}}if(this[_symbols.first] instanceof Dodo){var desc={};var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{var _loop2=function _loop2(){var colname=_step8.value;desc[colname]={get:function get(){return new Flock(_this3,colname);}};};for(var _iterator8=Object.keys(this[_symbols.first].array.index)[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){_loop2();}}catch(err){_didIteratorError8=true;_iteratorError8=err;}finally {try{if(!_iteratorNormalCompletion8&&_iterator8.return){_iterator8.return();}}finally {if(_didIteratorError8){throw _iteratorError8;}}}Object.defineProperties(this,desc);}else {this.hash[Symbol.iterator]=regeneratorRuntime.mark(function _callee(){var _iteratorNormalCompletion9,_didIteratorError9,_iteratorError9,_iterator9,_step9,_step9$value,key,iter;return regeneratorRuntime.wrap(function _callee$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_iteratorNormalCompletion9=true;_didIteratorError9=false;_iteratorError9=undefined;_context3.prev=3;_iterator9=Object.entries(this)[Symbol.iterator]();case 5:if(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done){_context3.next=14;break;}_step9$value=_slicedToArray(_step9.value,2);key=_step9$value[0];iter=_step9$value[1];_context3.next=11;return [key,[].concat(_toConsumableArray(iter))];case 11:_iteratorNormalCompletion9=true;_context3.next=5;break;case 14:_context3.next=20;break;case 16:_context3.prev=16;_context3.t0=_context3['catch'](3);_didIteratorError9=true;_iteratorError9=_context3.t0;case 20:_context3.prev=20;_context3.prev=21;if(!_iteratorNormalCompletion9&&_iterator9.return){_iterator9.return();}case 23:_context3.prev=23;if(!_didIteratorError9){_context3.next=26;break;}throw _iteratorError9;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 _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{var _loop3=function _loop3(){var method=_step10.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 _iterator10=Object.getOwnPropertyNames(Dodo.prototype)[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){_loop3();}}catch(err){_didIteratorError10=true;_iteratorError10=err;}finally {try{if(!_iteratorNormalCompletion10&&_iterator10.return){_iterator10.return();}}finally {if(_didIteratorError10){throw _iteratorError10;}}}
'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;}}}

@@ -64,10 +64,4 @@ /***/ },

'use strict';Object.defineProperty(exports,"__esModule",{value:true});var first=exports.first=Symbol('first');var filter=exports.filter=Symbol('filter');
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var first=exports.first=Symbol('first');var filter=exports.filter=Symbol('filter');var col=exports.col=Symbol('col');var masks=exports.masks=Symbol('masks');
/***/ },
/* 2 */
/***/ function(module, exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var or=exports.or=function or(fns){var len=fns.length;return function(arg){var i=-1;var bool=false;while(++i<len){bool=bool||fns[i](arg);}return bool;};};
/***/ }

@@ -74,0 +68,0 @@ /******/ ])

11

package.json
{
"name": "dodos",
"version": "1.0.1",
"version": "1.1.0",
"description": "Pandas-inspired iterator-based data wrangling library for js",

@@ -8,4 +8,5 @@ "main": "dist/dodos.js",

"build": "webpack",
"prepublish": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
"prepublish": "npm run test && npm run build",
"test": "tap test/*.js",
"tdd": "nodemon -q -x 'npm run test'"
},

@@ -27,3 +28,7 @@ "repository": {

"babel-preset-es2015": "^6.5.0",
"babel-require": "^1.0.1",
"eslint": "^2.2.0",
"nodemon": "^1.9.1",
"regenerator": "^0.8.42",
"tap": "^5.7.0",
"webpack": "^1.12.14"

@@ -30,0 +35,0 @@ },

@@ -1,4 +0,5 @@

# Perspective
# Dodos
Pandas-inspired iterator-based data wrangling library for js
### Pandas-inspired iterator-based data wrangling library for js
On npm: https://www.npmjs.com/package/dodos

@@ -5,0 +6,0 @@ Note: requires regeneratorRuntime to be in scope

@@ -1,11 +0,5 @@

import {or} from './util'
import {first, filter} from './symbols'
import {first} from './symbols'
export default class Dodo {
constructor(array, masks, colname) {
let desc = {}
for (const colname of Object.keys(array.index))
desc[colname] = {get: () => new Dodo(array, masks, colname)}
Object.defineProperties(this, desc)
this.array = array

@@ -19,17 +13,22 @@ this.masks = masks || []

*[Symbol.iterator]() {
const masks = this.masks.length ? or(this.masks) : () => true
for (const row of this.array)
if (masks(row))
yield row
}
const rowObj = {}
let descs = {}
for (const colname of Object.keys(this.array.index))
descs[colname] = {get: () => this.array[i][this.array.index[colname]]}
Object.defineProperties(rowObj, descs)
[filter](fn) { return new Dodo(this.array, [...this.masks, fn]) }
eq(comp) {
return this[filter](row => row[this.col] === comp)
let i = -1
const len = this.array.length
while (++i < len) {
let j = -1
let bool = true
let masksLen = this.masks.length
while (bool && ++j < masksLen)
bool = bool && this.masks[j](rowObj)
if (bool)
yield this.array[i]
}
}
between(down, up) {
return this[filter](row => row[this.col] <= up && row[this.col] >= down)
}
filter(fn) { return new Dodo(this.array, [...this.masks, fn]) }

@@ -49,3 +48,3 @@ *map(fn) {

let i = 0
for (const row of this)
for (const row of this) // eslint-disable-line no-unused-vars
++i

@@ -82,3 +81,3 @@ return i

// still not sure about this part
// still unsure about this part
this.hash[Symbol.iterator] = function*() {

@@ -85,0 +84,0 @@ for (const [key, iter] of Object.entries(this))

export const first = Symbol('first')
export const filter = Symbol('filter')
export const col = Symbol('col')
export const masks = Symbol('masks')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc