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

angular-nav-thresholds

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-nav-thresholds - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

32

dist/bundle.js

@@ -6,2 +6,8 @@ (function (angular$1) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {

@@ -75,11 +81,16 @@ if (!(instance instanceof Constructor)) {

var requiredStateStoresAllocation = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
var options = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4];
if (!location || !location.allocations || !location.plans || !location.level) {
if (!location || !location.allocations || !location.allocations.length || !location.plans || !location.plans.length || !location.level) {
return;
}
if (!stockCount || !stockCount.allocations || !stockCount.allocations.version || !stockCount.plans || !stockCount.plans.version) {
if (!stockCount) {
return;
}
if (options.version !== 'last' && !(stockCount.allocations && _typeof(stockCount.allocations.version) !== undefined && stockCount.plans && _typeof(stockCount.plans.version) !== undefined)) {
return;
}
if (!products || !products.length) {

@@ -89,3 +100,9 @@ return;

var allocation = find(location.allocations, isVersion.bind(null, stockCount.allocations.version));
var allocation = void 0;
if (options.version === 'last') {
allocation = location.allocations[location.allocations.length - 1];
} else {
allocation = find(location.allocations, isVersion.bind(null, stockCount.allocations.version));
}
if (!(allocation && allocation.weeklyLevels)) {

@@ -96,6 +113,13 @@ return;

var weeklyLevels = allocation.weeklyLevels;
var weeksOfStock = zonesPlan;
if (location.level !== 'zone') {
var plan = find(location.plans, isVersion.bind(null, stockCount.plans.version));
var plan = void 0;
if (options.version === 'last') {
plan = location.plans[location.plans.length - 1];
} else {
plan = find(location.plans, isVersion.bind(null, stockCount.plans.version));
}
if (!(plan && plan.weeksOfStock)) {

@@ -102,0 +126,0 @@ return;

2

dist/bundle.min.js

@@ -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},i={min:0,reOrder:3,max:6},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,n){var s=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];if(e&&e.allocations&&e.plans&&e.level&&t&&t.allocations&&t.allocations.version&&t.plans&&t.plans.version&&n&&n.length){var o=a(e.allocations,r.bind(null,t.allocations.version));if(o&&o.weeklyLevels){var u=o.weeklyLevels,c=i;if("zone"!==e.level){var v=a(e.plans,r.bind(null,t.plans.version));if(!v||!v.weeksOfStock)return;c=v.weeksOfStock}var f=Object.keys(u).reduce(function(t,r){return t[r]=Object.keys(c).reduce(function(t,i){var o=u[r]*c[i],v=a(n,l.bind(null,r)),f=20;v&&v.presentation&&(f=parseInt(v.presentation,10));var h=Math.ceil(o/f)*f;return t[i]=h,"zone"===e.level&&s[r]&&(t[i]+=s[r]),t},{}),e.targetPopulation&&(t[r].targetPopulation=e.targetPopulation[r]),t},{});return f}}}},{key:"getThresholdsFor",value:function(e,t){var n=this,r="zone:?state:?lga",i={},s={};i=e.reduce(function(e,t){var a=t.location;if(!a)return e;var l=n.smartId.idify(a,r),i=t.allocations||{version:1},o=t.plans||{version:1};return e[l]=angular.merge({},{allocations:i,plans:o}),a.lga?(s.lga||(s.lga=n.lgasService.list()),e[l].type="lga"):a.state&&(s.state||(s.state=n.statesService.list()),e[l].type="state"),e},{});var o=function(e){return Object.keys(i).forEach(function(r){var s=i[r],o=a(e[s.type],l.bind(null,r));s.thresholds=n.calculateThresholds(o,s,t),delete s.type}),i};return this.$q.all(s).then(o)}}]),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"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=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}}(),r=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]},l=function(e,t){return t.version===e},o=function(e,t){return t._id===e},i={min:0,reOrder:3,max:6},s=function(){function e(t,a,r,l){n(this,e),this.$q=t,this.smartId=a,this.lgasService=r,this.statesService=l}return a(e,[{key:"calculateThresholds",value:function(e,n,a){var s=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],u=arguments.length<=4||void 0===arguments[4]?{}:arguments[4];if(e&&e.allocations&&e.allocations.length&&e.plans&&e.plans.length&&e.level&&n&&("last"===u.version||n.allocations&&void 0!==t(n.allocations.version)&&n.plans&&void 0!==t(n.plans.version))&&a&&a.length){var c=void 0;if(c="last"===u.version?e.allocations[e.allocations.length-1]:r(e.allocations,l.bind(null,n.allocations.version)),c&&c.weeklyLevels){var v=c.weeklyLevels,f=i;if("zone"!==e.level){var h=void 0;if(h="last"===u.version?e.plans[e.plans.length-1]:r(e.plans,l.bind(null,n.plans.version)),!h||!h.weeksOfStock)return;f=h.weeksOfStock}var d=Object.keys(v).reduce(function(t,n){return t[n]=Object.keys(f).reduce(function(t,l){var i=v[n]*f[l],u=r(a,o.bind(null,n)),c=20;u&&u.presentation&&(c=parseInt(u.presentation,10));var h=Math.ceil(i/c)*c;return t[l]=h,"zone"===e.level&&s[n]&&(t[l]+=s[n]),t},{}),e.targetPopulation&&(t[n].targetPopulation=e.targetPopulation[n]),t},{});return d}}}},{key:"getThresholdsFor",value:function(e,t){var n=this,a="zone:?state:?lga",l={},i={};l=e.reduce(function(e,t){var r=t.location;if(!r)return e;var l=n.smartId.idify(r,a),o=t.allocations||{version:1},s=t.plans||{version:1};return e[l]=angular.merge({},{allocations:o,plans:s}),r.lga?(i.lga||(i.lga=n.lgasService.list()),e[l].type="lga"):r.state&&(i.state||(i.state=n.statesService.list()),e[l].type="state"),e},{});var s=function(e){return Object.keys(l).forEach(function(a){var i=l[a],s=r(e[i.type],o.bind(null,a));i.thresholds=n.calculateThresholds(s,i,t),delete i.type}),l};return this.$q.all(i).then(s)}}]),e}();s.$inject=["$q","smartId","lgasService","statesService"],e.module("angularNavThresholds",["angularNavData","ngSmartId"]).service("thresholdsService",s)}(angular);

@@ -75,3 +75,3 @@ {

],
"version": "2.0.0"
"version": "2.1.0"
}
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