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

data-engine

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-engine - npm Package Compare versions

Comparing version 2.0.0-rc.11 to 2.0.0-rc.12

2

cjs/data-engine.development.js

@@ -1,2 +0,2 @@

/** @license Data-Engine v2.0.0-rc.11
/** @license Data-Engine v2.0.0-rc.12
* data-engine.development.js

@@ -3,0 +3,0 @@ *

@@ -1,2 +0,2 @@

/** @license Data-Engine v2.0.0-rc.11
/** @license Data-Engine v2.0.0-rc.12
* data-engine.production.min.js

@@ -3,0 +3,0 @@ *

{
"name": "data-engine",
"description": "Data engine is small data management lib for some sort and filter.",
"version": "2.0.0-rc.11",
"version": "2.0.0-rc.12",
"keywords": [

@@ -50,5 +50,5 @@ "Data",

"loose-envify": "^1.1.0",
"filter-value": "^2.0.0-rc.11",
"data-filter": "^2.0.0-rc.11",
"data-sort": "^2.0.0-rc.11"
"filter-value": "^2.0.0-rc.12",
"data-filter": "^2.0.0-rc.12",
"data-sort": "^2.0.0-rc.12"
},

@@ -55,0 +55,0 @@ "browserify": {

@@ -1,2 +0,2 @@

/** @license Engine v2.0.0-rc.11
/** @license Engine v2.0.0-rc.12
* data-engine.development.js

@@ -545,3 +545,3 @@ *

this.setPrimaryKey(primaryKey);
this.setData(data, true);
this.setData(data);
}

@@ -621,2 +621,7 @@ /**

/**
* Setting right function for sort,
*
*/
/**
* default sort with key

@@ -670,3 +675,3 @@ * Default sorting function when user won't add own function.

this.setData = function (data) {
var shouldSort = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var shouldSort = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

@@ -701,3 +706,3 @@ log('setData', 'should sort', shouldSort);

}
_this.sortFunc = _this.defaultSortWithKey;
_this.setSortFunction();
}

@@ -710,3 +715,3 @@ };

if (!_this.isCustomFunction) {
_this.sortFunc = _this.defaultSort;
_this.setSortFunction();
}

@@ -718,3 +723,3 @@ };

_this.isCustomFunction = false;
_this.sortFunc = _this.primaryKey ? _this.defaultSortWithKey : _this.defaultSort;
_this.setSortFunction();
};

@@ -735,2 +740,3 @@

}
_this.setSortFunction();
_this.currentName = name;

@@ -740,2 +746,13 @@ return _this.sortData();

this.setSortFunction = function () {
if (_this.isCustomFunction) {
return;
}
if (_this.currentName === _this.primaryKey) {
_this.sortFunc = _this.defaultSort;
} else {
_this.sortFunc = _this.defaultSortWithKey;
}
};
this.defaultSortWithKey = function (a, b) {

@@ -742,0 +759,0 @@ if (a[_this.currentName] === b[_this.currentName]) {

@@ -1,2 +0,2 @@

/** @license Data-Engine v2.0.0-rc.11
/** @license Data-Engine v2.0.0-rc.12
* data-engine.production.min.js

@@ -22,12 +22,12 @@ *

e(b)){case "boolean":c="boolean";break;case "function":c="func";break;case "object":Array.isArray(b)?c="array":b instanceof RegExp?c="regexp":b.from&&b.to&&a.checkRangeAbleTypes(b.from)===a.checkRangeAbleTypes(b.to)&&(c="range")}return c};this.checkRangeAbleTypes=function(a){var b=null;switch("undefined"===typeof a?"undefined":e(a)){case "string":b="string";break;case "number":b="number";break;case "object":a instanceof Date&&(b="date")}return b}},k=Object.freeze({default:d});d=k&&d||k;var m=d.default?
d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;g(this,a);r.call(this);this.currentName=null;this.sortFunc=this.defaultSort;this.setSortFunction(d);this.setPrimaryKey(c);this.setData(b,!0)}f(a,[{key:"SortFunction",set:function(a){this.setSortFunction(a)}},{key:"PrimaryKey",set:function(a){this.setPrimaryKey(a)}}]);return a}();
var r=function(){var a=this;this.setData=function(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:!1;a.data=b;return c?a.sortData():a.data};this.setSortFunction=function(b){"function"===typeof b&&(a.sortFunc=b,a.isCustomFunction=!0)};this.setPrimaryKey=function(b){!a.isCustomFunction&&"string"===typeof b&&0<b.length&&(a.primaryKey=b,null===a.currentName&&(a.currentName=b),a.sortFunc=a.defaultSortWithKey)};this.removePrimaryKey=function(){a.primaryKey="";a.isCustomFunction||(a.sortFunc=
a.defaultSort)};this.setDefaultSort=function(){a.isCustomFunction=!1;a.sortFunc=a.primaryKey?a.defaultSortWithKey:a.defaultSort};this.comparePrimaryKey=function(b,c){return b[a.primaryKey]>c[a.primaryKey]};this.compare=function(b,c){return b[a.currentName]>c[a.currentName]};this.sortBy=function(b){if(a.currentName===b)return a.reverseData();a.currentName=b;return a.sortData()};this.defaultSortWithKey=function(b,c){return b[a.currentName]===c[a.currentName]?a.comparePrimaryKey(b,c):a.compare(b,c)};
this.defaultSort=function(b,c){return a.compare(b,c)};this.sortData=function(){a.currentName&&(a.data=a.data.sort(a.sortFunc));return a.data};this.reverseData=function(){a.data=a.data.reverse();return a.data};this.getData=function(){return a.data}};d=(k=Object.freeze({default:d}))&&d||k;var l=d.default?d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;g(this,a);t.call(this);this.filtered=
b;this.filters={};this.SortEngine=c;this.Data=b}f(a,[{key:"Data",set:function(a){this.setData(a)},get:function(){return this.data}},{key:"FilteredData",get:function(){return this.getFilteredData()}},{key:"SortEngine",set:function(a){a instanceof l?(this.sortEngine=a,this.updateFce=this.filterWSort):(this.sortEngine=null,this.updateFce=this.filterWOSort)},get:function(){return this.sortEngine}}]);return a}();var t=function(){var a=this;this.updateFce=this.filterWOSort;this.setData=function(b){a.data=
b;return a.updateFilter()};this.update=function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=a.getFilteredData;c.forEach(function(b){if(!(b instanceof m))throw new TypeError(b+" has to have filterValue instance");a.filters[b.Name]=b;e=a.updateFilter});return e()};this.removeFilters=function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=a.getFilteredData;c.forEach(function(b){b="string"===typeof b?b:b.Name;a.filters[b]&&(delete a.filters[b],
e=a.updateFilter)});return e()};this.clearFilters=function(){a.filters={};a.filtered=a.data;return a.getFilteredData()};this.updateFilter=function(){if(null===a.data)throw Error("Data are null and cannot be filtered!");a.filtered=a.data.filter(a.filterAll);return a.getFilteredData()};this.filterAll=function(b){return Object.keys(a.filters).every(function(c){return a.filters[c].compare(b[c])})};this.getFilteredData=function(){return a.updateFce()};this.filterWOSort=function(){return a.filtered};this.filterWSort=
function(){return a.SortEngine.setData(a.filtered)};this.getFilter=function(b){return a.filters[b]?a.filters[b]:null}};d=(k=Object.freeze({default:d}))&&d||k;var n=d.default?d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;g(this,a);u.call(this);this.filterEngine=new n(b,new l(b,c,d))}f(a,[{key:"FilterEngine",get:function(){return this.filterEngine}},
{key:"SortEngine",get:function(){return this.filterEngine.SortEngine}},{key:"Data",get:function(){return this.getData()}}]);return a}();d.Filter=n;d.Sort=l;d.FilterValue=m;var u=function(){var a=this;this.setData=function(b){return a.FilterEngine.setData(b)};this.updateFilters=function(){var b;return(b=a.FilterEngine).update.apply(b,arguments)};this.removeFilters=function(){var b;return(b=a.FilterEngine).removeFilters.apply(b,arguments)};this.clearFilters=function(){return a.FilterEngine.clearFilters()};
this.setSortFunction=function(b){return a.SortEngine.setSortFunction(b)};this.setPrimaryKey=function(b){return a.SortEngine.setPrimaryKey(b)};this.removePrimaryKey=function(){return a.SortEngine.removePrimaryKey()};this.setDefaultSort=function(){return a.SortEngine.setDefaultSort()};this.sortBy=function(b){return a.SortEngine.sortBy(b)};this.sortData=function(){return a.SortEngine.sortData()};this.reverseData=function(){return a.SortEngine.reverseData()};this.getData=function(){return a.FilterEngine.FilteredData}};
d=(k=Object.freeze({default:d,FilterValue:m,Filter:n,Sort:l}))&&d||k;return d.default?d.default:d});
d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;g(this,a);r.call(this);this.currentName=null;this.sortFunc=this.defaultSort;this.setSortFunction(d);this.setPrimaryKey(c);this.setData(b)}f(a,[{key:"SortFunction",set:function(a){this.setSortFunction(a)}},{key:"PrimaryKey",set:function(a){this.setPrimaryKey(a)}}]);return a}();
var r=function(){var a=this;this.setData=function(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:!0;a.data=b;return c?a.sortData():a.data};this.setSortFunction=function(b){"function"===typeof b&&(a.sortFunc=b,a.isCustomFunction=!0)};this.setPrimaryKey=function(b){!a.isCustomFunction&&"string"===typeof b&&0<b.length&&(a.primaryKey=b,null===a.currentName&&(a.currentName=b),a.setSortFunction())};this.removePrimaryKey=function(){a.primaryKey="";a.isCustomFunction||a.setSortFunction()};
this.setDefaultSort=function(){a.isCustomFunction=!1;a.setSortFunction()};this.comparePrimaryKey=function(b,c){return b[a.primaryKey]>c[a.primaryKey]};this.compare=function(b,c){return b[a.currentName]>c[a.currentName]};this.sortBy=function(b){if(a.currentName===b)return a.reverseData();a.setSortFunction();a.currentName=b;return a.sortData()};this.setSortFunction=function(){a.isCustomFunction||(a.sortFunc=a.currentName===a.primaryKey?a.defaultSort:a.defaultSortWithKey)};this.defaultSortWithKey=function(b,
c){return b[a.currentName]===c[a.currentName]?a.comparePrimaryKey(b,c):a.compare(b,c)};this.defaultSort=function(b,c){return a.compare(b,c)};this.sortData=function(){a.currentName&&(a.data=a.data.sort(a.sortFunc));return a.data};this.reverseData=function(){a.data=a.data.reverse();return a.data};this.getData=function(){return a.data}};d=(k=Object.freeze({default:d}))&&d||k;var l=d.default?d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&
void 0!==arguments[1]?arguments[1]:null;g(this,a);t.call(this);this.filtered=b;this.filters={};this.SortEngine=c;this.Data=b}f(a,[{key:"Data",set:function(a){this.setData(a)},get:function(){return this.data}},{key:"FilteredData",get:function(){return this.getFilteredData()}},{key:"SortEngine",set:function(a){a instanceof l?(this.sortEngine=a,this.updateFce=this.filterWSort):(this.sortEngine=null,this.updateFce=this.filterWOSort)},get:function(){return this.sortEngine}}]);return a}();var t=function(){var a=
this;this.updateFce=this.filterWOSort;this.setData=function(b){a.data=b;return a.updateFilter()};this.update=function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=a.getFilteredData;c.forEach(function(b){if(!(b instanceof m))throw new TypeError(b+" has to have filterValue instance");a.filters[b.Name]=b;e=a.updateFilter});return e()};this.removeFilters=function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=a.getFilteredData;c.forEach(function(b){b=
"string"===typeof b?b:b.Name;a.filters[b]&&(delete a.filters[b],e=a.updateFilter)});return e()};this.clearFilters=function(){a.filters={};a.filtered=a.data;return a.getFilteredData()};this.updateFilter=function(){if(null===a.data)throw Error("Data are null and cannot be filtered!");a.filtered=a.data.filter(a.filterAll);return a.getFilteredData()};this.filterAll=function(b){return Object.keys(a.filters).every(function(c){return a.filters[c].compare(b[c])})};this.getFilteredData=function(){return a.updateFce()};
this.filterWOSort=function(){return a.filtered};this.filterWSort=function(){return a.SortEngine.setData(a.filtered)};this.getFilter=function(b){return a.filters[b]?a.filters[b]:null}};d=(k=Object.freeze({default:d}))&&d||k;var n=d.default?d.default:d;d=function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;g(this,a);u.call(this);this.filterEngine=
new n(b,new l(b,c,d))}f(a,[{key:"FilterEngine",get:function(){return this.filterEngine}},{key:"SortEngine",get:function(){return this.filterEngine.SortEngine}},{key:"Data",get:function(){return this.getData()}}]);return a}();d.Filter=n;d.Sort=l;d.FilterValue=m;var u=function(){var a=this;this.setData=function(b){return a.FilterEngine.setData(b)};this.updateFilters=function(){var b;return(b=a.FilterEngine).update.apply(b,arguments)};this.removeFilters=function(){var b;return(b=a.FilterEngine).removeFilters.apply(b,
arguments)};this.clearFilters=function(){return a.FilterEngine.clearFilters()};this.setSortFunction=function(b){return a.SortEngine.setSortFunction(b)};this.setPrimaryKey=function(b){return a.SortEngine.setPrimaryKey(b)};this.removePrimaryKey=function(){return a.SortEngine.removePrimaryKey()};this.setDefaultSort=function(){return a.SortEngine.setDefaultSort()};this.sortBy=function(b){return a.SortEngine.sortBy(b)};this.sortData=function(){return a.SortEngine.sortData()};this.reverseData=function(){return a.SortEngine.reverseData()};
this.getData=function(){return a.FilterEngine.FilteredData}};d=(k=Object.freeze({default:d,FilterValue:m,Filter:n,Sort:l}))&&d||k;return d.default?d.default:d});
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