any[], emptyElement: ObjectConstructor = Object) => { const _input: any[] = [], result = []; for (let index0 = 0, len1 = order.length; index0 < len1; index0++) { _input.push(Object.assign({}, order[index0])); } loop: for (let index1 = 0, len1 = order.length; index1 < len1; index1++) { for (let index2 = 0, len2 = _input.length; index2 < len2; index2++) { if (order[index1] === _input[index2][idField]) { result.push(_input[index2]); index2 = len2; continue loop; } } result.push(new emptyElement()); } return result; };