var apiName = 'Activity';
var askedFields = 'heheh KIM fdsfas BABO AHO';
//before curring
var getRelationName = false;
if(apiName === 'Activity' && askedFields.indexOf('KIM') > -1)
{
activityGetRelationName = true;
}
var getIndividualRelationName = false;
if(apiName === 'Activity' && askedFields.indexOf('TAEHO') > -1)
{
getIndividualRelationName = true;
}
//add condition for 1 year after
var getIndividualRelationWarukuti = false;
if(apiName === 'Activity' && askedFields.indexOf('BABO') > -1)
{
getIndividualRelationWarukuti = true;
}
console.log(` activityGetRelationName:${ getRelationName}`);
console.log(` activityGetIndividualRelationN ame:${ getIndividualRelationName}`);
console.log(` activityGetIndividualRelationW arukuti:${ getIndividualRelationWarukuti} `);
//change curring
function curringOut(argApiName)
{
var apiName = argApiName;
return function(condition)
{
if(!condition) return false;
return apiName && condition;
}
}
function findWord(word)
{
return askedFields.indexOf(word) > -1;
}
var isAskedFiled = curringOut(apiName);
var getRelationName2 = isAskedFiled(findWord('KIM'));
var getIndividualRelationName2 = isAskedFiled(findWord('TAEHO') );
var getIndividualRelationWarukuti2 = isAskedFiled(findWord('BABO')) ;
console.log(`getRelationName2: ${getRelationName2}`);
console.log(` getIndividualRelationName2:${ getIndividualRelationName2}`);
console.log(` getIndividualRelationWarukuti2 :${ getIndividualRelationWarukuti2 }`);
0 comments:
댓글 쓰기