angular-nav-thresholds
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
!function(n){"use strict";n="default"in n?n.default:n;var e=function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function n(n,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,t.key,t)}}return function(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}}(),t=function(n,e){for(var r=0;r<n.length;r++)if(e(n[r]))return n[r]},o=function(n,e){return e.version===n},a=function(){function n(){e(this,n)}return r(n,[{key:"calculateThresholds",value:function(n,e){if(n&&n.allocations&&n.plans&&e&&e.allocations&&e.allocations.version&&e.plans&&e.plans.version){var r=t(n.allocations,o.bind(null,e.allocations.version)).weeklyLevels,a=t(n.plans,o.bind(null,e.plans.version)).weeksOfStock,l=Object.keys(r).reduce(function(n,e){return n[e]=Object.keys(a).reduce(function(n,t){return n[t]=Math.round(r[e]*a[t]),n},{}),n},{});return l}}}]),n}();n.module("angularNavThresholds",[]).service("thresholdsService",a)}(angular); | ||
!function(n){"use strict";n="default"in n?n.default:n;var e=function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function n(n,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,t.key,t)}}return function(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}}(),t=function(n,e){for(var r=0;r<n.length;r++)if(e(n[r]))return n[r]},a=function(n,e){return e.version===n},o=function(){function n(){e(this,n)}return r(n,[{key:"calculateThresholds",value:function(n,e){if(n&&n.allocations&&n.plans&&e&&e.allocations&&e.allocations.version&&e.plans&&e.plans.version){var r=t(n.allocations,a.bind(null,e.allocations.version));if(r&&r.weeklyLevels){var o=t(n.plans,a.bind(null,e.plans.version));if(o&&o.weeksOfStock){var l=r.weeklyLevels,i=o.weeksOfStock,u=Object.keys(l).reduce(function(n,e){return n[e]=Object.keys(i).reduce(function(n,r){return n[r]=Math.round(l[e]*i[r]),n},{}),n},{});return u}}}}}]),n}();n.module("angularNavThresholds",[]).service("thresholdsService",o)}(angular); |
{ | ||
"name": "angular-nav-thresholds", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle.js", |
@@ -10,5 +10,3 @@ const find = (list, match) => { | ||
const isVersion = (version, item) => { | ||
return item.version === version | ||
} | ||
const isVersion = (version, item) => item.version === version | ||
@@ -26,4 +24,12 @@ class ThresholdsService { | ||
const weeklyLevels = find(location.allocations, isVersion.bind(null, stockCount.allocations.version)).weeklyLevels | ||
const weeksOfStock = find(location.plans, isVersion.bind(null, stockCount.plans.version)).weeksOfStock | ||
const allocation = find(location.allocations, isVersion.bind(null, stockCount.allocations.version)) | ||
if (!(allocation && allocation.weeklyLevels)) { | ||
return | ||
} | ||
const plan = find(location.plans, isVersion.bind(null, stockCount.plans.version)) | ||
if (!(plan && plan.weeksOfStock)) { | ||
return | ||
} | ||
const weeklyLevels = allocation.weeklyLevels | ||
const weeksOfStock = plan.weeksOfStock | ||
@@ -30,0 +36,0 @@ let thresholds = Object.keys(weeklyLevels).reduce((index, product) => { |
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
18876
171