I want to make a function (possibly using Currying method) in GEE to do a modification of my featureCollection. In the code bellow I wrote a function_infunction to add a new property "label" (which is an integer value given as an input argument) to the feature collection:
var addLabel = function(l){
return function(feature) {
return feature.set({label:l});
};
};
var DFV_coll = cc_features.filter(ee.Filter.eq('CUL','A')).map(addLabel(11));
It works well. I do however want to extend this function so that I can relate the value of the property "lable" to another proberty "CUL". This means that if the property "CUL" has 5 different valus inside my featureCollection, I want the correspoding "label" values to be set accordingly. I am thinking of providing a dictionary of key/values like:
var dict = {'A':11, 'B':2, 'C':-1 ...}
And do this all at once inside my function. How should I approach this extention?