UNPKG

react-microspreadsheet

Version:

A pluggable spreadsheet component.

37 lines (29 loc) 1.01 kB
// Generated by CoffeeScript 1.8.0 var addrIndex, firstCellFromMulti, getAddressFromCoord, getCoordFromAddress, lastCellFromMulti, letters; letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; getAddressFromCoord = function(coord) { return letters[coord[1]] + (coord[0] + 1); }; addrIndex = {}; getCoordFromAddress = function(addr) { if (!(addr in addrIndex)) { addrIndex[addr] = [parseInt(addr.slice(1)) - 1, letters.indexOf(addr[0])]; } return addrIndex[addr]; }; firstCellFromMulti = function(multi) { return [Math.min(multi[0][0], multi[1][0]), Math.min(multi[0][1], multi[1][1])]; }; lastCellFromMulti = function(multi) { return [Math.max(multi[0][0], multi[1][0]), Math.max(multi[0][1], multi[1][1])]; }; module.exports = { letters: letters, getAddressFromCoord: getAddressFromCoord, getCoordFromAddress: getCoordFromAddress, firstCellFromMulti: firstCellFromMulti, lastCellFromMulti: lastCellFromMulti, log: function(res, base) { return Math.log(res) / Math.log(base); } };