UNPKG

molstar

Version:

A comprehensive macromolecular library.

27 lines 839 B
"use strict"; /** * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getChainId = void 0; var memoize_1 = require("../../../mol-util/memoize"); var ChainIdAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; function _getChainId(index) { var n = ChainIdAlphabet.length; var j = index; var k = 0; var chainId = ChainIdAlphabet[j % n]; while (j >= n) { j = Math.floor(j / n); chainId += ChainIdAlphabet[j % n]; k += 1; } if (k >= 5) { console.warn('getChainId overflow'); } return chainId; } exports.getChainId = (0, memoize_1.memoize1)(_getChainId); //# sourceMappingURL=util.js.map