Closed scne closed 7 years ago
not, but you can write your own dict with callFunction
function MyCustomDict (dictionary) {
return function(key){
return typeof dictionary[key] === 'function' ? dict[key](key) : dict[key];
}
}
and use this
var JM = require('json-mapper');
var converter = JM.makeConverter({
type: [
'type' ,
MyCustomDict({
1: function () { return 'someFunctionResult' },
2: 'crop',
3: 'fit'
})
]
});
console.log('\n\n\n convert with default \n\n', converter({
'type': 1
})); // { type: "someFunctionResult" }
Is it possible to call
JM.ch
intodict
prcedure?