class Utilities { constructor() { } getSpecific(key, idset, objectset) { var objIndex = 0; var objOffsetCounter = 0; if(key.indexOf(".") != -1) { var counterString = key.split("."); objIndex = parseInt(counterString[0]) - 1; key = counterString[1]; } objOffsetCounter = objIndex; if(idset == null) { return null; } for(var index in idset) { var objId = idset[index]; if(objId == null) { continue; } var otherItem = objectset[idset[index]]; if(otherItem.keywords.indexOf(key) != -1 && objOffsetCounter-- == 0) { return otherItem; } } } } module.exports = new Utilities();