MCPcopy Index your code
hub / github.com/handsontable/handsontable / colToProp

Method colToProp

handsontable/src/dataMap/dataMap.ts:264–284  ·  view source on GitHub ↗

* Returns property name that corresponds with the given column index. * * @param {string|number} column Visual column index or another passed argument. * @returns {string|number} Column property, physical column index or passed argument.

(column: number)

Source from the content-addressed store, hash-verified

262 * @returns {string|number} Column property, physical column index or passed argument.
263 */
264 colToProp(column: number) {
265 // TODO: Should it work? Please, look at the test:
266 // "it should return the provided property name, when the user passes a property name as a column number".
267 if (Number.isInteger(column) === false) {
268 return column;
269 }
270
271 const physicalColumn = this.hot!.toPhysicalColumn(column);
272
273 // Out of range, not visible column index.
274 if (physicalColumn === null) {
275 return column;
276 }
277
278 // Cached property.
279 if (this.colToPropCache && isDefined(this.colToPropCache[physicalColumn])) {
280 return this.colToPropCache[physicalColumn];
281 }
282
283 return physicalColumn;
284 }
285
286 /**
287 * Translates property into visual column index.

Callers 3

replaceDataFunction · 0.95
clearMethod · 0.95
getRangeMethod · 0.95

Calls 2

isDefinedFunction · 0.90
toPhysicalColumnMethod · 0.80

Tested by

no test coverage detected