// eslint-disable-next-line no-undefined const UNDEF = undefined; function getAllValuesofObj (obj: any): any[] { let values = Object.keys(obj).map((key: any) => { return obj[key]; }); return values; } function ascComparer(index: number, schema: any) { let fieldType = schema[index].type; return function (a: { [x: string]: number; }, b: { [x: string]: number; }) { if(fieldType === 'number'){ return a[index] > b[index]; } return String(a[index]).localeCompare(String(b[index])); }; } function descComparer(index: number, schema: any) { let fieldType = schema[index].type; return function (a: { [x: string]: number; }, b: { [x: string]: number; }) { if(fieldType === 'number'){ return b[index] > a[index]; } return String(b[index]).localeCompare(String(a[index])); }; } function getConfigScope(localState: any, globalState: any){ if(localState !== UNDEF && localState !== null){ return localState; } return globalState; } function getSubPropertyValue(gridConfig: any, cellIndex: any, parent: any, subProperty: any, defaultValue: any){ let localState = gridConfig.columns[cellIndex] && gridConfig.columns[cellIndex][parent] && gridConfig.columns[cellIndex][parent][subProperty], globalState = gridConfig.defaultcolumnoptions && gridConfig.defaultcolumnoptions[parent] && gridConfig.defaultcolumnoptions[parent][subProperty]; if(localState !== UNDEF){ return localState; } else if(globalState !== UNDEF){ return globalState; } return defaultValue; } export { getAllValuesofObj, ascComparer, descComparer, getConfigScope, getSubPropertyValue };