UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

22 lines (21 loc) 716 B
export const validDataSource = (dataSourceInfo) => { if (!dataSourceInfo || !Array.isArray(dataSourceInfo.columns)) { throw `We can't find any columns in your configuration`; } if (!dataSourceInfo.columns.length) { throw 'You should have at least one column'; } const allStringColumns = dataSourceInfo.columns.reduce((acc, col) => { if (!col || typeof col !== 'string') { return false; } return acc; }, true); if (!allStringColumns) { throw `Some of your columns are not strings`; } if (!Array.isArray(dataSourceInfo.data)) { throw `We can't find the data array in your configuration`; } return true; };