angular-nav-thresholds
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,1 +0,1 @@ | ||
!function(e){"use strict";e="default"in e?e.default:e;var t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),a=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]},r=function(e,t){return t.version===e},l=function(e,t){return t._id===e},s=function(){function e(n,a,r,l){t(this,e),this.$q=n,this.smartId=a,this.lgasService=r,this.statesService=l}return n(e,[{key:"calculateThresholds",value:function(e,t){if(e&&e.allocations&&e.plans&&t&&t.allocations&&t.allocations.version&&t.plans&&t.plans.version){var n=a(e.allocations,r.bind(null,t.allocations.version));if(n&&n.weeklyLevels){var l=a(e.plans,r.bind(null,t.plans.version));if(l&&l.weeksOfStock){var s=n.weeklyLevels,i=l.weeksOfStock,o=Object.keys(s).reduce(function(e,t){return e[t]=Object.keys(i).reduce(function(e,n){return e[n]=Math.round(s[t]*i[n]),e},{}),e},{});return o}}}}},{key:"getThresholdsFor",value:function(e){var t=this,n="zone:?state:?lga",r={},s={};r=e.reduce(function(e,a){var r=a.location;if(!r)return e;var l=t.smartId.idify(r,n),i=a.allocations||{version:1},o=a.plans||{version:1};return e[l]=angular.merge({},{allocations:i,plans:o}),r.lga?(s.lga||(s.lga=t.lgasService.list()),e[l].type="lga"):r.state&&(s.state||(s.state=t.statesService.list()),e[l].type="state"),e},{});var i=function(e){return Object.keys(r).forEach(function(n){var s=r[n],i=a(e[s.type],l.bind(null,n));s.thresholds=t.calculateThresholds(i,s),delete s.type}),r};return this.$q.all(s).then(i)}}]),e}();s.$inject=["$q","smartId","lgasService","statesService"],e.module("angularNavThresholds",["angularNavData","ngSmartId"]).service("thresholdsService",s)}(angular); | ||
!function(e){"use strict";e="default"in e?e.default:e;var t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),a=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]},r=function(e,t){return t.version===e},l=function(e,t){return t._id===e},s=function(){function e(n,a,r,l){t(this,e),this.$q=n,this.smartId=a,this.lgasService=r,this.statesService=l}return n(e,[{key:"calculateThresholds",value:function(e,t){if(e&&e.allocations&&e.plans&&t&&t.allocations&&t.allocations.version&&t.plans&&t.plans.version){var n=a(e.allocations,r.bind(null,t.allocations.version));if(n&&n.weeklyLevels){var l=a(e.plans,r.bind(null,t.plans.version));if(l&&l.weeksOfStock){var s=n.weeklyLevels,i=l.weeksOfStock,o=Object.keys(s).reduce(function(t,n){return t[n]=Object.keys(i).reduce(function(e,t){return e[t]=Math.round(s[n]*i[t]),e},{}),t[n].targetPopulation=e.targetPopulation[n],t},{});return o}}}}},{key:"getThresholdsFor",value:function(e){var t=this,n="zone:?state:?lga",r={},s={};r=e.reduce(function(e,a){var r=a.location;if(!r)return e;var l=t.smartId.idify(r,n),i=a.allocations||{version:1},o=a.plans||{version:1};return e[l]=angular.merge({},{allocations:i,plans:o}),r.lga?(s.lga||(s.lga=t.lgasService.list()),e[l].type="lga"):r.state&&(s.state||(s.state=t.statesService.list()),e[l].type="state"),e},{});var i=function(e){return Object.keys(r).forEach(function(n){var s=r[n],i=a(e[s.type],l.bind(null,n));s.thresholds=t.calculateThresholds(i,s),delete s.type}),r};return this.$q.all(s).then(i)}}]),e}();s.$inject=["$q","smartId","lgasService","statesService"],e.module("angularNavThresholds",["angularNavData","ngSmartId"]).service("thresholdsService",s)}(angular); |
{ | ||
"name": "angular-nav-thresholds", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle.js", |
@@ -48,2 +48,3 @@ const find = (list, match) => { | ||
}, {}) | ||
index[product].targetPopulation = location.targetPopulation[product] | ||
return index | ||
@@ -50,0 +51,0 @@ }, {}) |
@@ -49,2 +49,6 @@ 'use strict' | ||
], | ||
targetPopulation: { | ||
'product:a': 1000, | ||
'product:b': 2000 | ||
}, | ||
plans: [ | ||
@@ -79,3 +83,4 @@ { | ||
reOrder: 200, | ||
max: 500 | ||
max: 500, | ||
targetPopulation: 1000 | ||
}, | ||
@@ -85,3 +90,4 @@ 'product:b': { | ||
reOrder: 400, | ||
max: 1000 | ||
max: 1000, | ||
targetPopulation: 2000 | ||
} | ||
@@ -107,4 +113,4 @@ } | ||
thresholds: { | ||
'product:a': { min: 100, reOrder: 200, max: 500 }, | ||
'product:b': { min: 200, reOrder: 400, max: 1000 } | ||
'product:a': { min: 100, reOrder: 200, max: 500, targetPopulation: 1000 }, | ||
'product:b': { min: 200, reOrder: 400, max: 1000, targetPopulation: 2000 } | ||
} | ||
@@ -116,4 +122,4 @@ }, | ||
thresholds: { | ||
'product:a': { min: 50, reOrder: 100, max: 250 }, | ||
'product:b': { min: 100, reOrder: 200, max: 500 } | ||
'product:a': { min: 50, reOrder: 100, max: 250, targetPopulation: 1000 }, | ||
'product:b': { min: 100, reOrder: 200, max: 500, targetPopulation: 2000 } | ||
} | ||
@@ -120,0 +126,0 @@ } |
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
24124
293