Skip to content

Instantly share code, notes, and snippets.

@arslanbekov
Created July 29, 2015 13:18
Show Gist options
  • Save arslanbekov/f1064ec7352939484bda to your computer and use it in GitHub Desktop.
Save arslanbekov/f1064ec7352939484bda to your computer and use it in GitHub Desktop.
maps.
var data = (function() {
var me = {};
me.list = {
'ku': [
{'egd':['bars','Кто-то еще']},
{'cont':'bars'},
{'oo':['irtech']},
{'spo':'Аверс'},
],
'da': [
{'egd':['dnevnik','irtech','Еще кто-то']},
{'cont':'dnevnik'},
{'oo':'РиК'},
{'odo':'irtech'},
],
'kr': [
{'egd':['bars']},
{'cont':'dnevnik'},
{'oo':'bars'},
{'odo':'bars'},
{'doo':'dnevnik'},
],
};
me.init = function (){
};
me.getProductsByRegion = function(region) {
if (typeof me.list[region] !== "undefined")
{
list = [];
for (k in me.list[region]) {
list.push(k);
}
return list;
}
};
me.getRegionsByProduct = function(product) {
result = [];
for (reg in me.list) {
for (i in me.list[reg]) {
if (typeof me.list[reg][i][product] !== "undefined")
{
result.push(reg);
break;
}
}
}
return result;
}
return me;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment