MCPcopy Create free account
hub / github.com/totaljs/framework / counter_parse_days_all

Function counter_parse_days_all

nosql.js:4062–4089  ·  view source on GitHub ↗
(output, value, year, opt)

Source from the content-addressed store, hash-verified

4060}
4061
4062function counter_parse_days_all(output, value, year, opt) {
4063 var arr = value.trim().split(';');
4064 for (var i = 1, length = arr.length; i < length; i++) {
4065 var val = arr[i].substring(5);
4066 var key = year + arr[i].substring(0, 4);
4067
4068 if (!output[key]) {
4069 output[key] = opt.type2 ? counter_minmax(opt, val) : +val;
4070 continue;
4071 }
4072
4073 switch (opt.type2 || opt.type) {
4074 case 'max':
4075 var a = counter_minmax(opt, val);
4076 if (output[year] < a)
4077 output[year] = a;
4078 break;
4079 case 'min':
4080 var a = counter_minmax(opt, val);
4081 if (output[year] > a)
4082 output[year] = a;
4083 break;
4084 case 'sum':
4085 output[key] += +val;
4086 break;
4087 }
4088 }
4089}
4090
4091CP.save = function() {
4092 var self = this;

Callers 1

nosql.jsFile · 0.85

Calls 1

counter_minmaxFunction · 0.85

Tested by

no test coverage detected