diff --git a/.eslintrc.json b/.eslintrc.json index 933594f7fa724af9a9edf400be4578882f8f0b8d..23a38ed5a21d4753b46e50e59f61f35482795290 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -48,7 +48,8 @@ "prefer-const": ["error", { "destructuring": "all", "ignoreReadBeforeAssign": false - }] + }], + "space-before-function-paren": "off" }, "overrides": [ { @@ -99,7 +100,12 @@ "error", "1tbs", { "allowSingleLine": true } ], - "@typescript-eslint/comma-spacing": "error" + "@typescript-eslint/comma-spacing": "error", + "@typescript-eslint/space-before-function-paren": ["error", { + "anonymous": "always", + "named": "never", + "asyncArrow": "always" + }] } } ] diff --git a/src/apps/docking-viewer/viewport.tsx b/src/apps/docking-viewer/viewport.tsx index 4d4b5015420fd805bb47d2f91986e8b7180c2bd9..2e954753cfd76fd15f1fa0aad1f75b01d7fc1111 100644 --- a/src/apps/docking-viewer/viewport.tsx +++ b/src/apps/docking-viewer/viewport.tsx @@ -238,7 +238,7 @@ export class ViewportComponent extends PluginUIComponent { pocketPreset = () => this.set(PocketPreset); interactionsPreset = () => this.set(InteractionsPreset); - get showButtons () { + get showButtons() { return this.plugin.config.get(ShowButtons); } diff --git a/src/cli/cifschema/util/generate.ts b/src/cli/cifschema/util/generate.ts index a47f4e5b63e92368607835eeb53025931c6e4d55..96bdd5bfd8ebab38e3f7066962c36272897b7a95 100644 --- a/src/cli/cifschema/util/generate.ts +++ b/src/cli/cifschema/util/generate.ts @@ -8,7 +8,7 @@ import { Database, Filter, Column } from './schema'; import { indentString } from '../../../mol-util/string'; import { FieldPath } from '../../../mol-io/reader/cif/schema'; -function header (name: string, info: string, moldataImportPath: string) { +function header(name: string, info: string, moldataImportPath: string) { return `/** * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * @@ -22,7 +22,7 @@ import { Database, Column } from '${moldataImportPath}/db'; import Schema = Column.Schema;`; } -function footer (name: string) { +function footer(name: string) { return ` export type ${name}_Schema = typeof ${name}_Schema; export interface ${name}_Database extends Database<${name}_Schema> {};`; @@ -89,7 +89,7 @@ function doc(description: string, spacesCount: number) { ].join('\n'); } -export function generate (name: string, info: string, schema: Database, fields: Filter | undefined, moldataImportPath: string, addAliases: boolean) { +export function generate(name: string, info: string, schema: Database, fields: Filter | undefined, moldataImportPath: string, addAliases: boolean) { const codeLines: string[] = []; if (fields) { diff --git a/src/cli/cifschema/util/schema.ts b/src/cli/cifschema/util/schema.ts index 9763930cd5750140894a253762e01ee1633512c1..38081d104f9d1e7c651ac0589bc9a5349933cec1 100644 --- a/src/cli/cifschema/util/schema.ts +++ b/src/cli/cifschema/util/schema.ts @@ -51,7 +51,7 @@ export function ListCol(subType: 'int' | 'str' | 'float' | 'coord', separator: s export type Filter = { [ table: string ]: { [ column: string ]: true } } -export function mergeFilters (...filters: Filter[]) { +export function mergeFilters(...filters: Filter[]) { const n = filters.length; const mergedFilter: Filter = {}; const fields: Map<string, number> = new Map(); diff --git a/src/extensions/rcsb/assembly-symmetry/representation.ts b/src/extensions/rcsb/assembly-symmetry/representation.ts index ea36afe85155700399a53ea717b491d7d61ec4bd..92bb70c8d89faa14acc786b093c20b243768c055 100644 --- a/src/extensions/rcsb/assembly-symmetry/representation.ts +++ b/src/extensions/rcsb/assembly-symmetry/representation.ts @@ -310,7 +310,7 @@ function setSymbolTransform(t: Mat4, symbol: string, axes: AssemblySymmetry.Rota } } -const unitCircleDirections = (function() { +const unitCircleDirections = (function () { const dirs: Vec3[] = []; const circle = polygon(12, false, 1); for (let i = 0, il = circle.length; i < il; i += 3) { diff --git a/src/mol-canvas3d/camera.ts b/src/mol-canvas3d/camera.ts index 835c9198e02fcd41d1236aff2188a4f4edd305ce..5d1f7a584c02a832aa21cc3008f45bad241dc54a 100644 --- a/src/mol-canvas3d/camera.ts +++ b/src/mol-canvas3d/camera.ts @@ -34,7 +34,7 @@ class Camera implements ICamera { readonly inverseProjectionView: Mat4 = Mat4.identity(); private pixelScale: number - get pixelRatio () { + get pixelRatio() { const dpr = (typeof window !== 'undefined') ? window.devicePixelRatio : 1; return dpr * this.pixelScale; } diff --git a/src/mol-canvas3d/camera/util.ts b/src/mol-canvas3d/camera/util.ts index 0e3b31766debbb99e731c9dfd7b31cee4403825d..6e787cbb0595ee654fed8b8ff6f943e700f27663 100644 --- a/src/mol-canvas3d/camera/util.ts +++ b/src/mol-canvas3d/camera/util.ts @@ -61,7 +61,7 @@ const FAR_RANGE = 1; const tmpVec4 = Vec4(); /** Transform point into 2D window coordinates. */ -export function cameraProject (out: Vec4, point: Vec3, viewport: Viewport, projectionView: Mat4) { +export function cameraProject(out: Vec4, point: Vec3, viewport: Viewport, projectionView: Mat4) { const { x: vX, y: vY, width: vWidth, height: vHeight } = viewport; // clip space -> NDC -> window coordinates, implicit 1.0 for w component @@ -90,7 +90,7 @@ export function cameraProject (out: Vec4, point: Vec3, viewport: Viewport, proje * Transform point from screen space to 3D coordinates. * The point must have x and y set to 2D window coordinates and z between 0 (near) and 1 (far). */ -export function cameraUnproject (out: Vec3, point: Vec3, viewport: Viewport, inverseProjectionView: Mat4) { +export function cameraUnproject(out: Vec3, point: Vec3, viewport: Viewport, inverseProjectionView: Mat4) { const { x: vX, y: vY, width: vWidth, height: vHeight } = viewport; const x = point[0] - vX; diff --git a/src/mol-canvas3d/helper/bounding-sphere-helper.ts b/src/mol-canvas3d/helper/bounding-sphere-helper.ts index 1e8a3125ddece82a6037353780a82ed41fa1eee6..ec230bf1f119ae7c251e8f18506c78d8e6e72aa8 100644 --- a/src/mol-canvas3d/helper/bounding-sphere-helper.ts +++ b/src/mol-canvas3d/helper/bounding-sphere-helper.ts @@ -121,7 +121,7 @@ export class BoundingSphereHelper { } get props() { return this._props as Readonly<DebugHelperProps>; } - setProps (props: Partial<DebugHelperProps>) { + setProps(props: Partial<DebugHelperProps>) { Object.assign(this._props, props); if (this.isEnabled) this.update(); } diff --git a/src/mol-canvas3d/util.ts b/src/mol-canvas3d/util.ts index a3955e5a121e6088a4c83e3641613a05c46b1b4e..8d5cfb353f7c684a71b4f05194faf463c6c1292d 100644 --- a/src/mol-canvas3d/util.ts +++ b/src/mol-canvas3d/util.ts @@ -12,7 +12,7 @@ export function setCanvasSize(canvas: HTMLCanvasElement, width: number, height: } /** Resize canvas to container element taking `devicePixelRatio` into account */ -export function resizeCanvas (canvas: HTMLCanvasElement, container: HTMLElement, scale = 1) { +export function resizeCanvas(canvas: HTMLCanvasElement, container: HTMLElement, scale = 1) { let width = window.innerWidth; let height = window.innerHeight; if (container !== document.body) { diff --git a/src/mol-data/int/tuple.ts b/src/mol-data/int/tuple.ts index 1ff1e76263cc2cf38305dc63ee691e46ba4153e1..26c2c7d59357b7bcfdafc832732e2d0c0b5213ff 100644 --- a/src/mol-data/int/tuple.ts +++ b/src/mol-data/int/tuple.ts @@ -15,7 +15,7 @@ interface IntTuple { '@type': 'int-tuple' } namespace IntTuple { export const Zero: IntTuple = 0 as any; - const { _int32, _float64, _int32_1, _float64_1 } = (function() { + const { _int32, _float64, _int32_1, _float64_1 } = (function () { const data = new ArrayBuffer(8); const data_1 = new ArrayBuffer(8); return { diff --git a/src/mol-geo/geometry/mesh/mesh-builder.ts b/src/mol-geo/geometry/mesh/mesh-builder.ts index f3a95d6829d66fd04413086540188311ce61f11a..145aa1fd5a8e6875e40bd37f3224bd13d6bbeb3b 100644 --- a/src/mol-geo/geometry/mesh/mesh-builder.ts +++ b/src/mol-geo/geometry/mesh/mesh-builder.ts @@ -152,7 +152,7 @@ export namespace MeshBuilder { }); } - export function getMesh (state: State): Mesh { + export function getMesh(state: State): Mesh { const { vertices, normals, indices, groups, mesh } = state; const vb = ChunkedArray.compact(vertices, true) as Float32Array; const ib = ChunkedArray.compact(indices, true) as Uint32Array; diff --git a/src/mol-geo/geometry/text/font-atlas.ts b/src/mol-geo/geometry/text/font-atlas.ts index a650a9e0b8a1728db504556a81637057b999f87b..f4355d228a626de1de5b0520647bdddf04bb8609 100644 --- a/src/mol-geo/geometry/text/font-atlas.ts +++ b/src/mol-geo/geometry/text/font-atlas.ts @@ -10,7 +10,7 @@ import { createTextureImage, TextureImage } from '../../../mol-gl/renderable/uti const TextAtlasCache: { [k: string]: FontAtlas } = {}; -export function getFontAtlas (props: Partial<FontAtlasProps>) { +export function getFontAtlas(props: Partial<FontAtlasProps>) { const hash = JSON.stringify(props); if (TextAtlasCache[hash] === undefined) { TextAtlasCache[hash] = new FontAtlas(props); @@ -69,7 +69,7 @@ export class FontAtlas { private readonly maxWidth: number private readonly middle: number - constructor (props: Partial<FontAtlasProps> = {}) { + constructor(props: Partial<FontAtlasProps> = {}) { const p = { ...PD.getDefaultValues(FontAtlasParams), ...props }; this.props = p; @@ -110,7 +110,7 @@ export class FontAtlas { this.placeholder = this.get(String.fromCharCode(0xFFFD)); } - get (char: string) { + get(char: string) { if (this.mapped[char] === undefined) { this.draw(char); @@ -144,7 +144,7 @@ export class FontAtlas { return this.mapped[char]; } - draw (char: string) { + draw(char: string) { const h = this.lineHeight; const ctx = this.scratchContext; const data = this.scratchData; diff --git a/src/mol-geo/util.ts b/src/mol-geo/util.ts index 754e226ea5e90e7d4117e1502131aed55c636a62..0aaf37d9d2f4e41c11d7464166076927ca40921b 100644 --- a/src/mol-geo/util.ts +++ b/src/mol-geo/util.ts @@ -8,7 +8,7 @@ import { Vec3, Mat4, Mat3 } from '../mol-math/linear-algebra'; import { NumberArray } from '../mol-util/type-helpers'; import { arrayMax } from '../mol-util/array'; -export function normalizeVec3Array<T extends NumberArray> (a: T, count: number) { +export function normalizeVec3Array<T extends NumberArray>(a: T, count: number) { for (let i = 0, il = count * 3; i < il; i += 3) { const x = a[i]; const y = a[i + 1]; @@ -23,7 +23,7 @@ export function normalizeVec3Array<T extends NumberArray> (a: T, count: number) const tmpV3 = Vec3(); -export function transformPositionArray (t: Mat4, array: NumberArray, offset: number, count: number) { +export function transformPositionArray(t: Mat4, array: NumberArray, offset: number, count: number) { for (let i = 0, il = count * 3; i < il; i += 3) { Vec3.fromArray(tmpV3, array, offset + i); Vec3.transformMat4(tmpV3, tmpV3, t); @@ -31,7 +31,7 @@ export function transformPositionArray (t: Mat4, array: NumberArray, offset: num } } -export function transformDirectionArray (n: Mat3, array: NumberArray, offset: number, count: number) { +export function transformDirectionArray(n: Mat3, array: NumberArray, offset: number, count: number) { for (let i = 0, il = count * 3; i < il; i += 3) { Vec3.fromArray(tmpV3, array, offset + i); Vec3.transformMat3(tmpV3, tmpV3, n); @@ -60,7 +60,7 @@ const ab = Vec3(); * http://www.iquilezles.org/www/articles/normals/normals.htm * - normals array must contain only zeros */ -export function computeIndexedVertexNormals<T extends NumberArray> (vertices: NumberArray, indices: NumberArray, normals: T, vertexCount: number, triangleCount: number) { +export function computeIndexedVertexNormals<T extends NumberArray>(vertices: NumberArray, indices: NumberArray, normals: T, vertexCount: number, triangleCount: number) { for (let i = 0, il = triangleCount * 3; i < il; i += 3) { const ai = indices[i] * 3; @@ -95,7 +95,7 @@ export function computeIndexedVertexNormals<T extends NumberArray> (vertices: Nu * vertex normals for unindexed triangle soup * - normals array must contain only zeros */ -export function computeVertexNormals<T extends NumberArray> (vertices: NumberArray, normals: T, vertexCount: number) { +export function computeVertexNormals<T extends NumberArray>(vertices: NumberArray, normals: T, vertexCount: number) { for (let i = 0, il = vertexCount * 3; i < il; i += 9) { Vec3.fromArray(a, vertices, i); Vec3.fromArray(b, vertices, i + 3); diff --git a/src/mol-geo/util/location-iterator.ts b/src/mol-geo/util/location-iterator.ts index 1200a22d990c9195fbd2392c5bd9adc1429e7cc4..a0df302c50faf57688e97b7a124074d941c54edb 100644 --- a/src/mol-geo/util/location-iterator.ts +++ b/src/mol-geo/util/location-iterator.ts @@ -53,8 +53,8 @@ export function LocationIterator(groupCount: number, instanceCount: number, stri let voidInstances = false; return { - get hasNext () { return hasNext; }, - get isNextNewInstance () { return isNextNewInstance; }, + get hasNext() { return hasNext; }, + get isNextNewInstance() { return isNextNewInstance; }, groupCount, instanceCount, count: groupCount * instanceCount, diff --git a/src/mol-gl/_spec/gl.shim.ts b/src/mol-gl/_spec/gl.shim.ts index 7456e53cb272e4edf1397af21b8762c2e373f7ad..049a3a3e57f9c558413c27adb4de2431ac145571 100644 --- a/src/mol-gl/_spec/gl.shim.ts +++ b/src/mol-gl/_spec/gl.shim.ts @@ -335,37 +335,37 @@ export function createGl(width: number, height: number, contextAttributes: WebGL canvas: { width, height } as HTMLCanvasElement, - getAttachedShaders: function(program: WebGLProgram) { + getAttachedShaders: function (program: WebGLProgram) { return [] as WebGLShader[]; }, - getBufferParameter: function(target: number, pname: number) { + getBufferParameter: function (target: number, pname: number) { return 0; }, - getContextAttributes: function() { return contextAttributes; }, - getFramebufferAttachmentParameter: function() {}, - getProgramInfoLog: function() { return ''; }, - getShaderInfoLog: function() { return ''; }, - getRenderbufferParameter: function() {}, - getShaderPrecisionFormat: function(shadertype: number, precisiontype: number) { + getContextAttributes: function () { return contextAttributes; }, + getFramebufferAttachmentParameter: function () {}, + getProgramInfoLog: function () { return ''; }, + getShaderInfoLog: function () { return ''; }, + getRenderbufferParameter: function () {}, + getShaderPrecisionFormat: function (shadertype: number, precisiontype: number) { return { precision: 0, rangeMax: 0, rangeMin: 0 }; }, - getShaderSource: function(shader: WebGLShader | null) { return ''; }, - getTexParameter: function() {}, - getUniform: function() {}, - getVertexAttrib: function() {}, - getVertexAttribOffset: function(index: number, pname: number) { return 0; }, - hint: function(target: number, mode: number) {}, - isBuffer: function(buffer: WebGLBuffer | null) { return true; }, - isEnabled: function(cap: number) { return true; }, - isFramebuffer: function(framebuffer: WebGLFramebuffer | null) { return true; }, - isProgram: function(program: WebGLProgram | null) { return true; }, - isRenderbuffer: function(renderbuffer: WebGLRenderbuffer | null) { return true; }, - isShader: function(shader: WebGLShader | null) { return true; }, - isTexture: function(texture: WebGLTexture | null) { return true; }, + getShaderSource: function (shader: WebGLShader | null) { return ''; }, + getTexParameter: function () {}, + getUniform: function () {}, + getVertexAttrib: function () {}, + getVertexAttribOffset: function (index: number, pname: number) { return 0; }, + hint: function (target: number, mode: number) {}, + isBuffer: function (buffer: WebGLBuffer | null) { return true; }, + isEnabled: function (cap: number) { return true; }, + isFramebuffer: function (framebuffer: WebGLFramebuffer | null) { return true; }, + isProgram: function (program: WebGLProgram | null) { return true; }, + isRenderbuffer: function (renderbuffer: WebGLRenderbuffer | null) { return true; }, + isShader: function (shader: WebGLShader | null) { return true; }, + isTexture: function (texture: WebGLTexture | null) { return true; }, getExtension: function (extensionName: string): any { switch (extensionName) { case 'EXT_blend_minmax': return { @@ -386,10 +386,10 @@ export function createGl(width: number, height: number, contextAttributes: WebGL } as EXT_sRGB; case 'OES_vertex_array_object': return { VERTEX_ARRAY_BINDING_OES: 0, - bindVertexArrayOES: function(arrayObject: WebGLVertexArrayObjectOES) { }, - createVertexArrayOES: function(): WebGLVertexArrayObjectOES { return {}; }, - deleteVertexArrayOES: function(arrayObject: WebGLVertexArrayObjectOES) { }, - isVertexArrayOES: function(value: any) { return true; } + bindVertexArrayOES: function (arrayObject: WebGLVertexArrayObjectOES) { }, + createVertexArrayOES: function (): WebGLVertexArrayObjectOES { return {}; }, + deleteVertexArrayOES: function (arrayObject: WebGLVertexArrayObjectOES) { }, + isVertexArrayOES: function (value: any) { return true; } } as OES_vertex_array_object; case 'WEBGL_color_buffer_float': return { FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0, @@ -404,8 +404,8 @@ export function createGl(width: number, height: number, contextAttributes: WebGL } as WEBGL_debug_shaders; case 'WEBGL_draw_buffers': return null; case 'WEBGL_lose_context': return { - loseContext: function() { }, - restoreContext: function() { }, + loseContext: function () { }, + restoreContext: function () { }, } as WEBGL_lose_context; case 'WEBGL_depth_texture': return { UNSIGNED_INT_24_8_WEBGL: 0 @@ -426,9 +426,9 @@ export function createGl(width: number, height: number, contextAttributes: WebGL } as OES_standard_derivatives; case 'OES_element_index_uint': return {} as OES_element_index_uint; case 'ANGLE_instanced_arrays': return { - drawArraysInstancedANGLE: function(mode: number, first: number, count: number, primcount: number) {}, - drawElementsInstancedANGLE: function(mode: number, count: number, type: number, offset: number, primcount: number) {}, - vertexAttribDivisorANGLE: function(index: number, divisor: number) {}, + drawArraysInstancedANGLE: function (mode: number, first: number, count: number, primcount: number) {}, + drawElementsInstancedANGLE: function (mode: number, count: number, type: number, offset: number, primcount: number) {}, + vertexAttribDivisorANGLE: function (index: number, divisor: number) {}, VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0 } as ANGLE_instanced_arrays; } diff --git a/src/mol-gl/renderable/util.ts b/src/mol-gl/renderable/util.ts index c7317af09a52d2f3f88cd7c384aa0fcb7cb34655..d548d16dbfc2374a16ac9ec539a8ad5aba8c0fba 100644 --- a/src/mol-gl/renderable/util.ts +++ b/src/mol-gl/renderable/util.ts @@ -9,7 +9,7 @@ import { Vec3, Mat4 } from '../../mol-math/linear-algebra'; import { BoundaryHelper } from '../../mol-math/geometry/boundary-helper'; import { TextureFilter } from '../webgl/texture'; -export function calculateTextureInfo (n: number, itemSize: number) { +export function calculateTextureInfo(n: number, itemSize: number) { n = Math.max(n, 2); // observed issues with 1 pixel textures const sqN = Math.sqrt(n); let width = Math.ceil(sqN); diff --git a/src/mol-gl/webgl/context.ts b/src/mol-gl/webgl/context.ts index 7d3d3be1f8fd5aa4bd392e4acfb88a3a2b50ecaf..7f255febaeee485d10adbcb2dfad07ddcec33b3a 100644 --- a/src/mol-gl/webgl/context.ts +++ b/src/mol-gl/webgl/context.ts @@ -51,7 +51,7 @@ export function checkError(gl: GLRenderingContext) { } } -function unbindResources (gl: GLRenderingContext) { +function unbindResources(gl: GLRenderingContext) { // bind null to all texture units const maxTextureImageUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); for (let i = 0; i < maxTextureImageUnits; ++i) { @@ -280,7 +280,7 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal return { gl, isWebGL2: isWebGL2(gl), - get pixelRatio () { + get pixelRatio() { const dpr = (typeof window !== 'undefined') ? window.devicePixelRatio : 1; return dpr * (props.pixelScale || 1); }, @@ -290,17 +290,17 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal stats, resources, - get maxTextureSize () { return parameters.maxTextureSize; }, - get max3dTextureSize () { return parameters.max3dTextureSize; }, - get maxRenderbufferSize () { return parameters.maxRenderbufferSize; }, - get maxDrawBuffers () { return parameters.maxDrawBuffers; }, - get maxTextureImageUnits () { return parameters.maxTextureImageUnits; }, + get maxTextureSize() { return parameters.maxTextureSize; }, + get max3dTextureSize() { return parameters.max3dTextureSize; }, + get maxRenderbufferSize() { return parameters.maxRenderbufferSize; }, + get maxDrawBuffers() { return parameters.maxDrawBuffers; }, + get maxTextureImageUnits() { return parameters.maxTextureImageUnits; }, namedComputeRenderables: Object.create(null), namedFramebuffers: Object.create(null), namedTextures: Object.create(null), - get isContextLost () { + get isContextLost() { return isContextLost || gl.isContextLost(); }, contextRestored, diff --git a/src/mol-gl/webgl/renderbuffer.ts b/src/mol-gl/webgl/renderbuffer.ts index 5b076b84ea282bce36d7c87c157e6763f112999d..857422fda22d433af6071cfe616e0ff4c6631f9d 100644 --- a/src/mol-gl/webgl/renderbuffer.ts +++ b/src/mol-gl/webgl/renderbuffer.ts @@ -53,7 +53,7 @@ function getRenderbuffer(gl: GLRenderingContext) { return renderbuffer; } -export function createRenderbuffer (gl: GLRenderingContext, format: RenderbufferFormat, attachment: RenderbufferAttachment, _width: number, _height: number): Renderbuffer { +export function createRenderbuffer(gl: GLRenderingContext, format: RenderbufferFormat, attachment: RenderbufferAttachment, _width: number, _height: number): Renderbuffer { let _renderbuffer = getRenderbuffer(gl); const bind = () => gl.bindRenderbuffer(gl.RENDERBUFFER, _renderbuffer); diff --git a/src/mol-gl/webgl/texture.ts b/src/mol-gl/webgl/texture.ts index b309b6fe8b42f1651483e5da7d1bae9029fe8c0d..93f654581a728e1ca1438d219d7b4f43707feab1 100644 --- a/src/mol-gl/webgl/texture.ts +++ b/src/mol-gl/webgl/texture.ts @@ -400,7 +400,7 @@ export function createTextures(ctx: WebGLContext, schema: RenderableSchema, valu */ export function loadImageTexture(src: string, cell: ValueCell<Texture>, texture: Texture) { const img = new Image(); - img.onload = function() { + img.onload = function () { texture.load(img); ValueCell.update(cell, texture); }; diff --git a/src/mol-gl/webgl/uniform.ts b/src/mol-gl/webgl/uniform.ts index ef97b2ae3b2e3ba9d140086f489d6d184f160853..446eab858fbcf9a3f051f20afcb9282f2983ec46 100644 --- a/src/mol-gl/webgl/uniform.ts +++ b/src/mol-gl/webgl/uniform.ts @@ -45,15 +45,15 @@ export function getUniformType(gl: GLRenderingContext, kind: UniformKind) { export type UniformSetter = (gl: GLRenderingContext, location: number, value: any) => void export type UniformSetters = { [k: string]: UniformSetter } -function uniform1f (gl: GLRenderingContext, location: number, value: any) { gl.uniform1f(location, value); } -function uniform1fv (gl: GLRenderingContext, location: number, value: any) { gl.uniform1fv(location, value); } -function uniform1i (gl: GLRenderingContext, location: number, value: any) { gl.uniform1i(location, value); } -function uniform1iv (gl: GLRenderingContext, location: number, value: any) { gl.uniform1iv(location, value); } -function uniform2fv (gl: GLRenderingContext, location: number, value: any) { gl.uniform2fv(location, value); } -function uniform3fv (gl: GLRenderingContext, location: number, value: any) { gl.uniform3fv(location, value); } -function uniform4fv (gl: GLRenderingContext, location: number, value: any) { gl.uniform4fv(location, value); } -function uniformMatrix3fv (gl: GLRenderingContext, location: number, value: any) { gl.uniformMatrix3fv(location, false, value); } -function uniformMatrix4fv (gl: GLRenderingContext, location: number, value: any) { gl.uniformMatrix4fv(location, false, value); } +function uniform1f(gl: GLRenderingContext, location: number, value: any) { gl.uniform1f(location, value); } +function uniform1fv(gl: GLRenderingContext, location: number, value: any) { gl.uniform1fv(location, value); } +function uniform1i(gl: GLRenderingContext, location: number, value: any) { gl.uniform1i(location, value); } +function uniform1iv(gl: GLRenderingContext, location: number, value: any) { gl.uniform1iv(location, value); } +function uniform2fv(gl: GLRenderingContext, location: number, value: any) { gl.uniform2fv(location, value); } +function uniform3fv(gl: GLRenderingContext, location: number, value: any) { gl.uniform3fv(location, value); } +function uniform4fv(gl: GLRenderingContext, location: number, value: any) { gl.uniform4fv(location, value); } +function uniformMatrix3fv(gl: GLRenderingContext, location: number, value: any) { gl.uniformMatrix3fv(location, false, value); } +function uniformMatrix4fv(gl: GLRenderingContext, location: number, value: any) { gl.uniformMatrix4fv(location, false, value); } function getUniformSetter(kind: UniformKind): UniformSetter { switch (kind) { diff --git a/src/mol-io/reader/cif/schema.ts b/src/mol-io/reader/cif/schema.ts index 44be2a0a9af7450adcae08a57996ec58f344cd92..8a0aaaf2f7dabb730acb2fa79b1509277806661e 100644 --- a/src/mol-io/reader/cif/schema.ts +++ b/src/mol-io/reader/cif/schema.ts @@ -131,7 +131,7 @@ class CategoryTable implements Table<any> { // tslint:disable-line:class-name const cache = Object.create(null); for (const k of fieldKeys) { Object.defineProperty(this, k, { - get: function() { + get: function () { if (cache[k]) return cache[k]; const fType = schema[k]; if (fType.valueType === 'list') { diff --git a/src/mol-io/reader/common/text/column/token.ts b/src/mol-io/reader/common/text/column/token.ts index 07233c721b79e113c0100dcd4daeafe0eaacc87a..8f13c8a1ee92a0f4ea511ff5b370d24c4b0a3722 100644 --- a/src/mol-io/reader/common/text/column/token.ts +++ b/src/mol-io/reader/common/text/column/token.ts @@ -39,7 +39,7 @@ export function TokenColumn<T extends Column.Schema>(tokens: Tokens, schema: T): export function areValuesEqualProvider(tokens: Tokens) { const { data, indices } = tokens; - return function(rowA: number, rowB: number) { + return function (rowA: number, rowB: number) { const aS = indices[2 * rowA], bS = indices[2 * rowB]; const len = indices[2 * rowA + 1] - aS; if (len !== indices[2 * rowB + 1] - bS) return false; diff --git a/src/mol-io/reader/common/text/tokenizer.ts b/src/mol-io/reader/common/text/tokenizer.ts index 7a5f69518051603cc809e61315a7067234f1e239..b64e8138d70a8124763d4c63f941fc5e78efbaca 100644 --- a/src/mol-io/reader/common/text/tokenizer.ts +++ b/src/mol-io/reader/common/text/tokenizer.ts @@ -44,7 +44,7 @@ namespace Tokenizer { } /** Resets the state */ - export function reset (state: Tokenizer) { + export function reset(state: Tokenizer) { state.position = 0; state.lineNumber = 1; state.tokenStart = 0; diff --git a/src/mol-io/reader/csv/parser.ts b/src/mol-io/reader/csv/parser.ts index 8d81cd570cff06ddd1f60909ee5a1f0749d53567..3e6dd115abb8bfe4b0ad6c1fdc2648ae28be47be 100644 --- a/src/mol-io/reader/csv/parser.ts +++ b/src/mol-io/reader/csv/parser.ts @@ -233,7 +233,7 @@ function readRecordsChunks(state: State) { (ctx, state) => ctx.update({ message: 'Parsing...', current: state.tokenizer.position, max: state.data.length })); } -function addColumn (state: State) { +function addColumn(state: State) { state.columnNames.push(Tokenizer.getTokenString(state.tokenizer)); state.tokens.push(TokenBuilder.create(state.tokenizer.data, state.data.length / 80)); } diff --git a/src/mol-math/approx.ts b/src/mol-math/approx.ts index a1d588a6b6fad930bb1da7df3795dd6538df0199..740475b3bba4d13f4141feede6957aed8bdf7e9e 100644 --- a/src/mol-math/approx.ts +++ b/src/mol-math/approx.ts @@ -172,14 +172,14 @@ const _a_fasterHalfCos = new ArrayBuffer(4); const _i_fasterHalfCos = new Int32Array(_a_fasterHalfCos); const _f_fasterHalfCos = new Float32Array(_a_fasterHalfCos); -function fasterHalfCos (v: number) { +function fasterHalfCos(v: number) { _f_fasterHalfCos[0] = v; _i_fasterHalfCos[0] &= 0x7FFFFFFF; const qpprox = 1.0 - twoOverPi * _f_fasterHalfCos[0]; return qpprox + _p_fasterHalfCos * qpprox * (1.0 - qpprox * qpprox); } -export function fastTan (v: number) { +export function fastTan(v: number) { const k = (v * invTwoPi) | 0; const half = (v < 0) ? -0.5 : 0.5; const x = v - (half + k) * twoPi; diff --git a/src/mol-math/geometry/molecular-surface.ts b/src/mol-math/geometry/molecular-surface.ts index b3c314e8d5a82de88a29ebd91416257e093f33f3..b361c100b9ee897aad68adf806f539e7123373b1 100644 --- a/src/mol-math/geometry/molecular-surface.ts +++ b/src/mol-math/geometry/molecular-surface.ts @@ -17,7 +17,7 @@ import { Box3D, GridLookup3D, fillGridDim } from '../../mol-math/geometry'; import { BaseGeometry } from '../../mol-geo/geometry/base'; import { Boundary } from './boundary'; -function normalToLine (out: Vec3, p: Vec3) { +function normalToLine(out: Vec3, p: Vec3) { out[0] = out[1] = out[2] = 1.0; if (p[0] !== 0) { out[0] = (p[1] + p[2]) / -p[0]; @@ -30,7 +30,7 @@ function normalToLine (out: Vec3, p: Vec3) { } type AnglesTables = { cosTable: Float32Array, sinTable: Float32Array } -function getAngleTables (probePositions: number): AnglesTables { +function getAngleTables(probePositions: number): AnglesTables { let theta = 0.0; const step = 2 * Math.PI / probePositions; @@ -112,7 +112,7 @@ export async function calcMolecularSurface(ctx: RuntimeContext, position: Requir * Calculate delta distance and set grid value to minimum of * itself and delta */ - function projectPointsRange (begI: number, endI: number) { + function projectPointsRange(begI: number, endI: number) { for (let i = begI; i < endI; ++i) { const j = OrderedSet.getAt(indices, i); const vx = px[j], vy = py[j], vz = pz[j]; @@ -292,7 +292,7 @@ export async function calcMolecularSurface(ctx: RuntimeContext, position: Requir } } - function projectToriiRange (begI: number, endI: number) { + function projectToriiRange(begI: number, endI: number) { for (let i = begI; i < endI; ++i) { const k = OrderedSet.getAt(indices, i); lookup3d.find(px[k], py[k], pz[k], radius[k]); diff --git a/src/mol-math/interpolate.ts b/src/mol-math/interpolate.ts index 29c2e1ccae6f44ff198ce18d2acd60b6f603f489..d073ee8e317e5c642a25bb286b20eee5d40087a0 100644 --- a/src/mol-math/interpolate.ts +++ b/src/mol-math/interpolate.ts @@ -4,33 +4,33 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -export function normalize (value: number, min: number, max: number) { +export function normalize(value: number, min: number, max: number) { return (value - min) / (max - min); } -export function clamp (value: number, min: number, max: number) { +export function clamp(value: number, min: number, max: number) { return Math.max(min, Math.min(max, value)); } -export function pclamp (value: number) { +export function pclamp(value: number) { return clamp(value, 0, 100); } -export function saturate (value: number) { +export function saturate(value: number) { return clamp(value, 0, 1); } -export function damp (value: number, dampingFactor: number) { +export function damp(value: number, dampingFactor: number) { const dampedValue = value * dampingFactor; return Math.abs(dampedValue) < 0.1 ? 0 : dampedValue; } -export function lerp (start: number, stop: number, alpha: number) { +export function lerp(start: number, stop: number, alpha: number) { return start + (stop - start) * alpha; } /** Catmul-Rom spline */ -export function spline (p0: number, p1: number, p2: number, p3: number, t: number, tension: number) { +export function spline(p0: number, p1: number, p2: number, p3: number, t: number, tension: number) { const v0 = (p2 - p0) * tension; const v1 = (p3 - p1) * tension; const t2 = t * t; @@ -43,22 +43,22 @@ export function quadraticBezier(p0: number, p1: number, p2: number, t: number) { return (k * k * p0) + (2 * k * t * p1) + (t * t * p2); } -export function smoothstep (min: number, max: number, x: number) { +export function smoothstep(min: number, max: number, x: number) { x = saturate(normalize(x, min, max)); return x * x * (3 - 2 * x); } -export function smootherstep (min: number, max: number, x: number) { +export function smootherstep(min: number, max: number, x: number) { x = saturate(normalize(x, min, max)); return x * x * x * (x * (x * 6 - 15) + 10); } -export function smootheststep (min: number, max: number, x: number) { +export function smootheststep(min: number, max: number, x: number) { x = saturate(normalize(x, min, max)); return -20 * Math.pow(x, 7) + 70 * Math.pow(x, 6) - 84 * Math.pow(x, 5) + 35 * Math.pow(x, 4); } -export function almostIdentity (value: number, start: number, stop: number) { +export function almostIdentity(value: number, start: number, stop: number) { if (value > start) return value; const a = 2 * stop - start; const b = 2 * start - 3 * stop; diff --git a/src/mol-math/linear-algebra/3d/quat.ts b/src/mol-math/linear-algebra/3d/quat.ts index e0c9ca342b62dc31e89e1d50581c4dc57cb9dc98..a3d754d540863df4d8d6f0d0a6de0983fc91c057 100644 --- a/src/mol-math/linear-algebra/3d/quat.ts +++ b/src/mol-math/linear-algebra/3d/quat.ts @@ -279,7 +279,7 @@ namespace Quat { const fromUnitVec3Temp = [0, 0, 0] as Vec3; /** Quaternion from two normalized unit vectors. */ - export function fromUnitVec3 (out: Quat, a: Vec3, b: Vec3) { + export function fromUnitVec3(out: Quat, a: Vec3, b: Vec3) { // assumes a and b are normalized let r = Vec3.dot(a, b) + 1; if (r < EPSILON) { diff --git a/src/mol-math/misc.ts b/src/mol-math/misc.ts index cecbf2d51d912e82b1b71c098ae15a42b1d0ac41..c275e02b65370cc3a5dc7fd576f16e62d2c7f788 100644 --- a/src/mol-math/misc.ts +++ b/src/mol-math/misc.ts @@ -7,15 +7,15 @@ export const halfPI = Math.PI / 2; export const PiDiv180 = Math.PI / 180; -export function degToRad (deg: number) { +export function degToRad(deg: number) { return deg * PiDiv180; // deg * Math.PI / 180 } -export function radToDeg (rad: number) { +export function radToDeg(rad: number) { return rad / PiDiv180; // rad * 180 / Math.PI } -export function isPowerOfTwo (x: number) { +export function isPowerOfTwo(x: number) { return (x !== 0) && (x & (x - 1)) === 0; } diff --git a/src/mol-model-formats/structure/common/component.ts b/src/mol-model-formats/structure/common/component.ts index 49c7df64253db61c041fd7d4fcc619c510bd3e48..dfa708dfa8b7e3b8abf56763e788b23c2903118b 100644 --- a/src/mol-model-formats/structure/common/component.ts +++ b/src/mol-model-formats/structure/common/component.ts @@ -33,7 +33,7 @@ const NonPolymerNames = new Set([ 'FMN', 'NCN', 'FNS', 'FMA' // Mononucleotides ]); -const StandardComponents = (function() { +const StandardComponents = (function () { const map = new Map<string, Component>(); const components: Component[] = [ { id: 'HIS', name: 'HISTIDINE', type: 'L-peptide linking' }, @@ -83,7 +83,7 @@ const StandardComponents = (function() { return map; })(); -const CharmmIonComponents = (function() { +const CharmmIonComponents = (function () { const map = new Map<string, Component>(); const components: Component[] = [ { id: 'ZN2', name: 'ZINC ION', type: 'Ion' }, @@ -126,7 +126,7 @@ export class ComponentBuilder { return atomIds; } - private hasAtomIds (atomIds: Set<string>, atomIdsList: Set<string>[]) { + private hasAtomIds(atomIds: Set<string>, atomIdsList: Set<string>[]) { for (let i = 0, il = atomIdsList.length; i < il; ++i) { if (!SetUtils.areIntersecting(atomIds, atomIdsList[i])) { return false; diff --git a/src/mol-model-formats/structure/common/util.ts b/src/mol-model-formats/structure/common/util.ts index 788a1e8cbe50123ce60b1eb7ef029ddf514c55ff..22fc7b4990f78090c01faa2bd73193952ae81930 100644 --- a/src/mol-model-formats/structure/common/util.ts +++ b/src/mol-model-formats/structure/common/util.ts @@ -8,7 +8,7 @@ import { memoize1 } from '../../../mol-util/memoize'; const ChainIdAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; -function _getChainId (index: number) { +function _getChainId(index: number) { const n = ChainIdAlphabet.length; let j = index; let k = 0; diff --git a/src/mol-model-props/computed/chemistry/functional-group.ts b/src/mol-model-props/computed/chemistry/functional-group.ts index 962e0400008cff46057921aaa7e45a2912e290d8..30bca2c610803a0f792d5cc8e50c1a80b68314b4 100644 --- a/src/mol-model-props/computed/chemistry/functional-group.ts +++ b/src/mol-model-props/computed/chemistry/functional-group.ts @@ -111,7 +111,7 @@ export function isSulfate(structure: Structure, unit: Unit.Atomic, index: Struct /** * Phosphor in a phosphate group */ -export function isPhosphate (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function isPhosphate(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { return ( typeSymbol(unit, index) === Elements.P && bondToElementCount(structure, unit, index, Elements.O) === bondCount(structure, unit, index) @@ -121,7 +121,7 @@ export function isPhosphate (structure: Structure, unit: Unit.Atomic, index: Str /** * Halogen with one bond to a carbon */ -export function isHalocarbon (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function isHalocarbon(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { return ( isHalogen(typeSymbol(unit, index)) && bondCount(structure, unit, index) === 1 && @@ -151,7 +151,7 @@ export function isCarbonyl(structure: Structure, unit: Unit.Atomic, index: Struc /** * Carbon in a carboxylate group */ -export function isCarboxylate (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function isCarboxylate(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let terminalOxygenCount = 0; if ( typeSymbol(unit, index) === Elements.C && @@ -173,7 +173,7 @@ export function isCarboxylate (structure: Structure, unit: Unit.Atomic, index: S /** * Carbon in a guanidine group */ -export function isGuanidine (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function isGuanidine(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let terminalNitrogenCount = 0; if ( typeSymbol(unit, index) === Elements.C && @@ -194,7 +194,7 @@ export function isGuanidine (structure: Structure, unit: Unit.Atomic, index: Str /** * Carbon in a acetamidine group */ -export function isAcetamidine (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function isAcetamidine(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let terminalNitrogenCount = 0; if ( typeSymbol(unit, index) === Elements.C && @@ -216,7 +216,7 @@ export function isAcetamidine (structure: Structure, unit: Unit.Atomic, index: S const PolarElements = new Set<ElementSymbol>(['N', 'O', 'S', 'F', 'CL', 'BR', 'I'] as ElementSymbol[]); export function isPolar(element: ElementSymbol) { return PolarElements.has(element); } -export function hasPolarNeighbour (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function hasPolarNeighbour(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let flag = false; eachBondedAtom(structure, unit, index, (unit: Unit.Atomic, index: StructureElement.UnitIndex) => { if (isPolar(typeSymbol(unit, index))) flag = true; @@ -224,7 +224,7 @@ export function hasPolarNeighbour (structure: Structure, unit: Unit.Atomic, inde return flag; } -export function hasAromaticNeighbour (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function hasAromaticNeighbour(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let flag = false; eachBondedAtom(structure, unit, index, (unit: Unit.Atomic, index: StructureElement.UnitIndex) => { if (isAromatic(unit, index)) flag = true; diff --git a/src/mol-model-props/computed/chemistry/geometry.ts b/src/mol-model-props/computed/chemistry/geometry.ts index 8f4ac189140fac81cb6e9c6fca0fdccc200f9b78..5caa0b2e993e4e484bbef28fb08c4403ecb3c2b5 100644 --- a/src/mol-model-props/computed/chemistry/geometry.ts +++ b/src/mol-model-props/computed/chemistry/geometry.ts @@ -50,7 +50,7 @@ export function geometryLabel(geometry: AtomGeometry): string { } } -export function assignGeometry (totalCoordination: number): AtomGeometry { +export function assignGeometry(totalCoordination: number): AtomGeometry { switch (totalCoordination) { case 0: return AtomGeometry.Spherical; case 1: return AtomGeometry.Terminal; @@ -79,7 +79,7 @@ const tmpPosX = Vec3(); /** * Calculate the angles x-a1-a2 for all x where x is a heavy atom (not H) bonded to ap1. */ -export function calcAngles (structure: Structure, unitA: Unit.Atomic, indexA: StructureElement.UnitIndex, unitB: Unit.Atomic, indexB: StructureElement.UnitIndex): number[] { +export function calcAngles(structure: Structure, unitA: Unit.Atomic, indexA: StructureElement.UnitIndex, unitB: Unit.Atomic, indexB: StructureElement.UnitIndex): number[] { const angles: number[] = []; unitA.conformation.position(unitA.elements[indexA], tmpPosA); unitB.conformation.position(unitB.elements[indexB], tmpPosB); @@ -102,7 +102,7 @@ export function calcAngles (structure: Structure, unitA: Unit.Atomic, indexA: St * @param {AtomProxy} ap2 Second atom (out-of-plane) * @return {number} Angle from plane to second atom */ -export function calcPlaneAngle (structure: Structure, unitA: Unit.Atomic, indexA: StructureElement.UnitIndex, unitB: Unit.Atomic, indexB: StructureElement.UnitIndex): number | undefined { +export function calcPlaneAngle(structure: Structure, unitA: Unit.Atomic, indexA: StructureElement.UnitIndex, unitB: Unit.Atomic, indexB: StructureElement.UnitIndex): number | undefined { unitA.conformation.position(unitA.elements[indexA], tmpPosA); unitB.conformation.position(unitB.elements[indexB], tmpPosB); Vec3.sub(tmpDir1, tmpPosB, tmpPosA); diff --git a/src/mol-model-props/computed/chemistry/valence-model.ts b/src/mol-model-props/computed/chemistry/valence-model.ts index b8991ef8d38d547dfbb1182cb5649e1c97481471..b84d9547780b6af295a40d955540176084f20204 100644 --- a/src/mol-model-props/computed/chemistry/valence-model.ts +++ b/src/mol-model-props/computed/chemistry/valence-model.ts @@ -36,7 +36,7 @@ const tmpConjBondItB = new Bond.ElementBondIterator(); * N,O with degree 4 cannot be conjugated. * N,O adjacent to P=O or S=O do not qualify (keeps sulfonamide N sp3 geom) */ -function isConjugated (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +function isConjugated(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { const element = typeSymbol(unit, index); const hetero = element === Elements.O || element === Elements.N; @@ -65,7 +65,7 @@ function isConjugated (structure: Structure, unit: Unit.Atomic, index: Structure return false; } -export function explicitValence (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { +export function explicitValence(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex) { let v = 0; // intra-unit bonds const { offset, edgeProps: { flags, order } } = unit.bonds; @@ -94,7 +94,7 @@ const tmpChargeBondItB = new Bond.ElementBondIterator(); * If only charge or hydrogens are to be assigned it takes * a much simpler view and deduces one from the other */ -export function calculateHydrogensCharge (structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex, props: ValenceModelProps) { +export function calculateHydrogensCharge(structure: Structure, unit: Unit.Atomic, index: StructureElement.UnitIndex, props: ValenceModelProps) { const hydrogenCount = bondToElementCount(structure, unit, index, Elements.H); const element = typeSymbol(unit, index); let charge = formalCharge(unit, index); diff --git a/src/mol-model/sequence/alignment/alignment.ts b/src/mol-model/sequence/alignment/alignment.ts index 55c3fcc51454705dd5a0358887ea3f2d84e1e245..a0fb519ab095a0e3789722d2dd09e5c059d30c7e 100644 --- a/src/mol-model/sequence/alignment/alignment.ts +++ b/src/mol-model/sequence/alignment/alignment.ts @@ -27,7 +27,7 @@ class Alignment { readonly n: number; readonly m: number readonly S: number[][] = []; readonly V: number[][] = []; readonly H: number[][] = [] - constructor (readonly seqA: ArrayLike<string>, readonly seqB: ArrayLike<string>, options: AlignmentOptions) { + constructor(readonly seqA: ArrayLike<string>, readonly seqB: ArrayLike<string>, options: AlignmentOptions) { this.gapPenalty = options.gapPenalty; this.gapExtensionPenalty = options.gapExtensionPenalty; this.substMatrix = options.substMatrix === 'default' ? undefined : SubstitutionMatrices[options.substMatrix]; @@ -36,7 +36,7 @@ class Alignment { this.m = this.seqB.length; } - private initMatrices () { + private initMatrices() { const { n, m, gapPenalty, S, V, H } = this; for (let i = 0; i <= n; ++i) { @@ -60,17 +60,17 @@ class Alignment { S[0][0] = 0; } - private makeScoreFn () { + private makeScoreFn() { const { seqA, seqB, substMatrix } = this; if (substMatrix) { - return function score (i: number, j: number) { + return function score(i: number, j: number) { const cA = seqA[i]; const cB = seqB[j]; return substMatrix[cA]?.[cB] ?? -4; }; } else { - return function scoreNoSubstMat (i: number, j: number) { + return function scoreNoSubstMat(i: number, j: number) { const cA = seqA[i]; const cB = seqB[j]; return cA === cB ? 5 : -3; @@ -78,7 +78,7 @@ class Alignment { } } - calculate () { + calculate() { this.initMatrices(); const scoreFn = this.makeScoreFn(); @@ -109,7 +109,7 @@ class Alignment { } } - trace (): { aliA: ArrayLike<string>, aliB: ArrayLike<string>, score: number } { + trace(): { aliA: ArrayLike<string>, aliB: ArrayLike<string>, score: number } { const scoreFn = this.makeScoreFn(); const { V, H, S, seqA, seqB, gapExtensionPenalty, gapPenalty } = this; diff --git a/src/mol-model/sequence/alignment/substitution-matrix.ts b/src/mol-model/sequence/alignment/substitution-matrix.ts index 21f4a2c851938f24e56885c074409cc42b1a0c64..b81612ca95a5d886c2461bbf24f1dd7229dad049 100644 --- a/src/mol-model/sequence/alignment/substitution-matrix.ts +++ b/src/mol-model/sequence/alignment/substitution-matrix.ts @@ -61,7 +61,7 @@ const blosum62 = [ export type SubstitutionMatrixData = Readonly<{ [k: string]: Readonly<{ [k: string]: number }> }>; -function prepareMatrix (cellNames: string, mat: number[][]): SubstitutionMatrixData { +function prepareMatrix(cellNames: string, mat: number[][]): SubstitutionMatrixData { let j: number; let i = 0; const matDict: Mutable<SubstitutionMatrixData> = {}; diff --git a/src/mol-model/structure/model/properties/atomic/bonds.ts b/src/mol-model/structure/model/properties/atomic/bonds.ts index f8ad9b974cc56dee237ae93ad5945e80efaf0be4..4dbda0b4c2b81bc84eb598621fe3aa251f9c46e9 100644 --- a/src/mol-model/structure/model/properties/atomic/bonds.ts +++ b/src/mol-model/structure/model/properties/atomic/bonds.ts @@ -63,7 +63,7 @@ const IntraBondOrderTable = new Map([ /** * Get order for bonds in aminoacids and nucleotides assuming standard IUPAC naming */ -export function getIntraBondOrderFromTable (compId: string, atomId1: string, atomId2: string) { +export function getIntraBondOrderFromTable(compId: string, atomId1: string, atomId2: string) { [atomId1, atomId2] = atomId1 < atomId2 ? [atomId1, atomId2] : [atomId2, atomId1]; if (AminoAcidNames.has(compId) && atomId1 === 'C' && atomId2 === 'O') return 2; if (BaseNames.has(compId) && atomId1 === 'OP1' && atomId2 === 'P') return 2; @@ -81,7 +81,7 @@ const InterBondOrderTable = new Map([ /** * Get order for bonds between component assuming PDBx/mmCIF naming. */ -export function getInterBondOrderFromTable (compId1: string, atomId1: string, compId2: string, atomId2: string) { +export function getInterBondOrderFromTable(compId1: string, atomId1: string, compId2: string, atomId2: string) { if (compId1 > compId2) { [compId1, compId2] = [compId2, compId1]; [atomId1, atomId2] = [atomId2, atomId1]; diff --git a/src/mol-model/structure/model/properties/atomic/types.ts b/src/mol-model/structure/model/properties/atomic/types.ts index 2b5855a4dbbd218c070d78f513a20b2d1bd36d2d..423dbd0c2287f15a75ba2fcd3384e8d21d82fda1 100644 --- a/src/mol-model/structure/model/properties/atomic/types.ts +++ b/src/mol-model/structure/model/properties/atomic/types.ts @@ -52,12 +52,12 @@ export function isTransitionMetal(element: ElementSymbol) { ); } -export function isLanthanide (element: ElementSymbol) { +export function isLanthanide(element: ElementSymbol) { const no = AtomNumber(element); return no >= 57 && no <= 71; } -export function isActinide (element: ElementSymbol) { +export function isActinide(element: ElementSymbol) { const no = AtomNumber(element); return no >= 89 && no <= 103; } diff --git a/src/mol-model/structure/structure/carbohydrates/compute.ts b/src/mol-model/structure/structure/carbohydrates/compute.ts index c788e20939735652bc88bcc9e1ec7de933fb4800..20949907ab2b3a92d602121b0b429571d27e049a 100644 --- a/src/mol-model/structure/structure/carbohydrates/compute.ts +++ b/src/mol-model/structure/structure/carbohydrates/compute.ts @@ -324,7 +324,7 @@ export function computeCarbohydrates(structure: Structure): Carbohydrates { return { links, terminalLinks, elements, partialElements, ...buildLookups(elements, links, terminalLinks) }; } -function buildLookups (elements: CarbohydrateElement[], links: CarbohydrateLink[], terminalLinks: CarbohydrateTerminalLink[]) { +function buildLookups(elements: CarbohydrateElement[], links: CarbohydrateLink[], terminalLinks: CarbohydrateTerminalLink[]) { function key(unit: Unit, element: ElementIndex) { return cantorPairing(unit.id, element); diff --git a/src/mol-model/structure/structure/unit.ts b/src/mol-model/structure/structure/unit.ts index 31c56a90592a8172aa2a9af5147038f49d8926e5..c68322ec210bc4674c196888f0596ebdff4780f1 100644 --- a/src/mol-model/structure/structure/unit.ts +++ b/src/mol-model/structure/structure/unit.ts @@ -84,7 +84,7 @@ namespace Unit { return { elements: units[0].elements, units, - get unitIndexMap () { + get unitIndexMap() { if (props.unitIndexMap) return props.unitIndexMap; props.unitIndexMap = getUnitIndexMap(units); return props.unitIndexMap; @@ -112,7 +112,7 @@ namespace Unit { } } - export function conformationId (unit: Unit) { + export function conformationId(unit: Unit) { return Unit.isAtomic(unit) ? unit.model.atomicConformation.id : unit.model.coarseConformation.id; } diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts index 2597e1c10276b254fab6e4df25147eb33d76a1b1..c145b6d91f7aa8e775f8d0e6d8aaa1729c5ae10d 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts @@ -143,7 +143,7 @@ export namespace VolumeStreaming { channels: Channels = {} - public get info () { + public get info() { return this.infoMap.get(this.params.entry.name)!; } diff --git a/src/mol-repr/shape/representation.ts b/src/mol-repr/shape/representation.ts index 28e58c0039b27cf2b42c478171beec8e5371f3ff..af0b769ee5ed459d6d1fc4448de2361c90f406f0 100644 --- a/src/mol-repr/shape/representation.ts +++ b/src/mol-repr/shape/representation.ts @@ -172,9 +172,9 @@ export function ShapeRepresentation<D, G extends Geometry, P extends Geometry.Pa return { label: 'Shape geometry', - get groupCount () { return locationIt ? locationIt.count : 0; }, - get props () { return currentProps; }, - get params () { return currentParams; }, + get groupCount() { return locationIt ? locationIt.count : 0; }, + get props() { return currentProps; }, + get params() { return currentParams; }, get state() { return _state; }, get theme() { return _theme; }, renderObjects, diff --git a/src/mol-repr/structure/complex-visual.ts b/src/mol-repr/structure/complex-visual.ts index 8f503ace41d9dd8bb1dfafdea68a19a9d14b2041..f6cdff35be3ab6b06f7d9260706259501b5e94df 100644 --- a/src/mol-repr/structure/complex-visual.ts +++ b/src/mol-repr/structure/complex-visual.ts @@ -215,7 +215,7 @@ export function ComplexVisual<G extends Geometry, P extends StructureParams & Ge return { get groupCount() { return locationIt ? locationIt.count : 0; }, - get renderObject () { return locationIt && locationIt.count ? renderObject : undefined; }, + get renderObject() { return locationIt && locationIt.count ? renderObject : undefined; }, createOrUpdate(ctx: VisualContext, theme: Theme, props: Partial<PD.Values<P>> = {}, structure?: Structure) { prepareUpdate(theme, props, structure || currentStructure); if (updateState.createGeometry) { diff --git a/src/mol-repr/structure/units-visual.ts b/src/mol-repr/structure/units-visual.ts index e4105f9eb16589aefee9e2e547f7a5a3f2e38c67..bf21764f34a077d9fdaf200a5a3536ae432f3270 100644 --- a/src/mol-repr/structure/units-visual.ts +++ b/src/mol-repr/structure/units-visual.ts @@ -269,7 +269,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom return { get groupCount() { return locationIt ? locationIt.count : 0; }, - get renderObject () { return locationIt && locationIt.count ? renderObject : undefined; }, + get renderObject() { return locationIt && locationIt.count ? renderObject : undefined; }, createOrUpdate(ctx: VisualContext, theme: Theme, props: PD.Values<P>, structureGroup?: StructureGroup) { prepareUpdate(theme, props, structureGroup || currentStructureGroup); if (updateState.createGeometry) { diff --git a/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts b/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts index 6fc6a0be74b0a0d64539734d6c381f8b83e9159c..8c56b96b7ef54de11291b0f57982c3ea53e9742b 100644 --- a/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts +++ b/src/mol-repr/structure/visual/carbohydrate-symbol-mesh.ts @@ -189,14 +189,14 @@ function CarbohydrateElementIterator(structure: Structure): LocationIterator { const groupCount = carbElements.length * 2; const instanceCount = 1; const location = StructureElement.Location.create(structure); - function getLocation (groupIndex: number, instanceIndex: number) { + function getLocation(groupIndex: number, instanceIndex: number) { const carb = carbElements[Math.floor(groupIndex / 2)]; const ring = carb.unit.rings.all[carb.ringIndex]; location.unit = carb.unit; location.element = carb.unit.elements[ring[0]]; return location; } - function isSecondary (elementIndex: number, instanceIndex: number) { + function isSecondary(elementIndex: number, instanceIndex: number) { return (elementIndex % 2) === 1; } return LocationIterator(groupCount, instanceCount, 1, getLocation, true, isSecondary); diff --git a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts index 249f55348882aba67983268c023bc8733276564a..c740ea4828c8a2ba584eb98e14c31c39d0d90c20 100644 --- a/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts +++ b/src/mol-repr/structure/visual/polymer-backbone-cylinder.ts @@ -62,7 +62,7 @@ function createPolymerBackboneCylinderImpostor(ctx: VisualContext, unit: Unit, s const pB = Vec3(); const pM = Vec3(); - const add = function(indexA: ElementIndex, indexB: ElementIndex, groupA: number, groupB: number, moleculeType: MoleculeType) { + const add = function (indexA: ElementIndex, indexB: ElementIndex, groupA: number, groupB: number, moleculeType: MoleculeType) { pos(indexA, pA); pos(indexB, pB); @@ -115,7 +115,7 @@ function createPolymerBackboneCylinderMesh(ctx: VisualContext, unit: Unit, struc const centerA = StructureElement.Location.create(structure, unit); const centerB = StructureElement.Location.create(structure, unit); - const add = function(indexA: ElementIndex, indexB: ElementIndex, groupA: number, groupB: number, moleculeType: MoleculeType) { + const add = function (indexA: ElementIndex, indexB: ElementIndex, groupA: number, groupB: number, moleculeType: MoleculeType) { centerA.element = indexA; centerB.element = indexB; diff --git a/src/mol-repr/structure/visual/util/link.ts b/src/mol-repr/structure/visual/util/link.ts index a91dfb9becd5394da8a95c93c0f19c6d5107c881..5d6f7d2a44ded649d6e88c702eaf52fedb3bbf0c 100644 --- a/src/mol-repr/structure/visual/util/link.ts +++ b/src/mol-repr/structure/visual/util/link.ts @@ -44,7 +44,7 @@ const tmpShiftV13 = Vec3(); const up = Vec3.create(0, 1, 0); /** Calculate 'shift' direction that is perpendiculat to v1 - v2 and goes through v3 */ -export function calculateShiftDir (out: Vec3, v1: Vec3, v2: Vec3, v3: Vec3 | null) { +export function calculateShiftDir(out: Vec3, v1: Vec3, v2: Vec3, v3: Vec3 | null) { Vec3.normalize(tmpShiftV12, Vec3.sub(tmpShiftV12, v1, v2)); if (v3 !== null) { Vec3.sub(tmpShiftV13, v1, v3); diff --git a/src/mol-repr/structure/visual/util/polymer/gap-iterator.ts b/src/mol-repr/structure/visual/util/polymer/gap-iterator.ts index 5b14b75c8345bbed168983240616525c281e8679..8f12043739bf7d631093fe94aa42710f992577f4 100644 --- a/src/mol-repr/structure/visual/util/polymer/gap-iterator.ts +++ b/src/mol-repr/structure/visual/util/polymer/gap-iterator.ts @@ -24,7 +24,7 @@ interface PolymerGapPair { centerB: StructureElement.Location } -function createPolymerGapPair (structure: Structure, unit: Unit) { +function createPolymerGapPair(structure: Structure, unit: Unit) { return { centerA: StructureElement.Location.create(structure, unit), centerB: StructureElement.Location.create(structure, unit), diff --git a/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts b/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts index 45606c094860f316f2e8bc99be2d82d6e4f94001..d8561b58fcc16aab13ea2e61071006e5a4154d57 100644 --- a/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts +++ b/src/mol-repr/structure/visual/util/polymer/trace-iterator.ts @@ -63,7 +63,7 @@ interface PolymerTraceElement { const SecStrucTypeNA = SecondaryStructureType.create(SecondaryStructureType.Flag.NA); -function createPolymerTraceElement (structure: Structure, unit: Unit): PolymerTraceElement { +function createPolymerTraceElement(structure: Structure, unit: Unit): PolymerTraceElement { return { center: StructureElement.Location.create(structure, unit), centerPrev: StructureElement.Location.create(structure, unit), diff --git a/src/mol-repr/volume/representation.ts b/src/mol-repr/volume/representation.ts index 5591c176ac268af960f155404d09b852ea53ae75..3d0f7ca0e9f44c3739b20cdfd56697c371c77009 100644 --- a/src/mol-repr/volume/representation.ts +++ b/src/mol-repr/volume/representation.ts @@ -169,7 +169,7 @@ export function VolumeVisual<G extends Geometry, P extends VolumeParams & Geomet return { get groupCount() { return locationIt ? locationIt.count : 0; }, - get renderObject () { return renderObject; }, + get renderObject() { return renderObject; }, async createOrUpdate(ctx: VisualContext, theme: Theme, props: Partial<PD.Values<P>> = {}, volume?: Volume) { prepareUpdate(theme, props, volume || currentVolume); if (updateState.createGeometry) { @@ -300,7 +300,7 @@ export function VolumeRepresentation<P extends VolumeParams>(label: string, ctx: get groupCount() { return visual ? visual.groupCount : 0; }, - get props () { return _props; }, + get props() { return _props; }, get params() { return _params; }, get state() { return _state; }, get theme() { return _theme; }, diff --git a/src/mol-script/language/symbol-table.ts b/src/mol-script/language/symbol-table.ts index 9d50226077988ebceac50468d6572ec7198245c6..357c99bc008e2f3836e969f5a2254ba123abaaf3 100644 --- a/src/mol-script/language/symbol-table.ts +++ b/src/mol-script/language/symbol-table.ts @@ -16,7 +16,7 @@ normalizeTable(MolScriptSymbolTable); export const SymbolList = symbolList(MolScriptSymbolTable); -export const SymbolMap = (function() { +export const SymbolMap = (function () { const map: { [id: string]: MSymbol | undefined } = Object.create(null); for (const s of SymbolList) map[s.id] = s; return map; diff --git a/src/mol-script/language/symbol-table/core.ts b/src/mol-script/language/symbol-table/core.ts index 6096b36b5a7ee0e75c0a130c018809e43c868a84..4661b69bc8305d6f71b91a66fea91a087b1b1800 100644 --- a/src/mol-script/language/symbol-table/core.ts +++ b/src/mol-script/language/symbol-table/core.ts @@ -184,7 +184,7 @@ normalizeTable(core); export const SymbolList = symbolList(core); -export const SymbolMap = (function() { +export const SymbolMap = (function () { const map: { [id: string]: MSymbol | undefined } = Object.create(null); for (const s of SymbolList) map[s.id] = s; return map; diff --git a/src/mol-script/language/symbol.ts b/src/mol-script/language/symbol.ts index ad8ef7e87bb4c273d91f517eb4f80f55ac2a06b4..3694880c9cf1419c5b6f7cfe9272a9f82dba90b0 100644 --- a/src/mol-script/language/symbol.ts +++ b/src/mol-script/language/symbol.ts @@ -64,7 +64,7 @@ export interface MSymbol<A extends Arguments = Arguments, T extends Type = Type> } export function MSymbol<A extends Arguments, T extends Type>(name: string, args: A, type: T, description?: string) { - const symbol: MSymbol<A, T> = function(args: ExpressionArguments<A['@type']>) { + const symbol: MSymbol<A, T> = function (args: ExpressionArguments<A['@type']>) { return Expression.Apply(Expression.Symbol(symbol.id), args as any); } as any; symbol.info = { namespace: '', name, description }; @@ -75,7 +75,7 @@ export function MSymbol<A extends Arguments, T extends Type>(name: string, args: } export function CustomPropSymbol<T extends Type>(namespace: string, name: string, type: T, description?: string) { - const symbol: MSymbol<Arguments<{}>, T> = function(args: ExpressionArguments<Arguments<{}>['@type']>) { + const symbol: MSymbol<Arguments<{}>, T> = function (args: ExpressionArguments<Arguments<{}>['@type']>) { return Expression.Apply(Expression.Symbol(symbol.id), args as any); } as any; symbol.info = { namespace, name, description }; diff --git a/src/mol-task/util/scheduler.ts b/src/mol-task/util/scheduler.ts index 065379501206bd2a2012469d488b4e52c080bec8..346d15f8701a9ff1a8ab55de7b4545a6df82846c 100644 --- a/src/mol-task/util/scheduler.ts +++ b/src/mol-task/util/scheduler.ts @@ -73,7 +73,7 @@ function createImmediateActions() { } function installNextTickImplementation() { - registerImmediate = function(handle) { + registerImmediate = function (handle) { process.nextTick(function () { runIfPresent(handle); }); }; } @@ -82,7 +82,7 @@ function createImmediateActions() { if (global && global.postMessage && !global.importScripts) { let postMessageIsAsynchronous = true; const oldOnMessage = global.onmessage; - global.onmessage = function() { + global.onmessage = function () { postMessageIsAsynchronous = false; }; global.postMessage('', '*'); @@ -97,7 +97,7 @@ function createImmediateActions() { // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages const messagePrefix = 'setImmediate$' + Math.random() + '$'; - const onGlobalMessage = function(event: any) { + const onGlobalMessage = function (event: any) { if (event.source === global && typeof event.data === 'string' && event.data.indexOf(messagePrefix) === 0) { @@ -111,26 +111,26 @@ function createImmediateActions() { (window as any).attachEvent('onmessage', onGlobalMessage); } - registerImmediate = function(handle) { + registerImmediate = function (handle) { window.postMessage(messagePrefix + handle, '*'); }; } function installMessageChannelImplementation() { const channel = new MessageChannel(); - channel.port1.onmessage = function(event) { + channel.port1.onmessage = function (event) { const handle = event.data; runIfPresent(handle); }; - registerImmediate = function(handle) { + registerImmediate = function (handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { const html = doc!.documentElement!; - registerImmediate = function(handle) { + registerImmediate = function (handle) { // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. let script = doc!.createElement('script') as any; @@ -145,7 +145,7 @@ function createImmediateActions() { } function installSetTimeoutImplementation() { - registerImmediate = function(handle) { + registerImmediate = function (handle) { setTimeout(runIfPresent, 0, handle); }; } diff --git a/src/mol-util/array.ts b/src/mol-util/array.ts index a5f9c9b42f8fff1f46e09fe21586da72ae915a17..5ff656c6b1d5f4a22a5e0d483d81f9cfc1dd1d6c 100644 --- a/src/mol-util/array.ts +++ b/src/mol-util/array.ts @@ -64,7 +64,7 @@ export function arrayRms(array: ArrayLike<number>) { } /** Fill an array with serial numbers starting from 0 until n - 1 (defaults to array.length) */ -export function fillSerial<T extends NumberArray> (array: T, n?: number) { +export function fillSerial<T extends NumberArray>(array: T, n?: number) { for (let i = 0, il = n ? Math.min(n, array.length) : array.length; i < il; ++i) array[i] = i; return array; } diff --git a/src/mol-util/color/names.ts b/src/mol-util/color/names.ts index f9c5e9feb49036b7f04b60e3ecdfe5cb05c2277a..cce3a202527df7333b6ae9aefbd0e201def27ff0 100644 --- a/src/mol-util/color/names.ts +++ b/src/mol-util/color/names.ts @@ -166,7 +166,7 @@ export const ColorNames = ColorMap({ }); export type ColorNames = typeof ColorNames export type ColorName = keyof ColorNames -export const ColorNamesValueMap = (function() { +export const ColorNamesValueMap = (function () { const map = new Map<Color, ColorName>(); Object.keys(ColorNames).forEach(name => { map.set(ColorNames[name as ColorName], name as ColorName); diff --git a/src/mol-util/download.ts b/src/mol-util/download.ts index 0d2887827f738d28e2a1edee969c86eb6022fae7..6b75cd5fb375bf0973c31c4b0d3196f5b81d2f03 100644 --- a/src/mol-util/download.ts +++ b/src/mol-util/download.ts @@ -4,7 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -function openUrl (url: string) { +function openUrl(url: string) { const opened = window.open(url, '_blank'); if (!opened) { window.location.href = url; @@ -21,7 +21,7 @@ function click(node: HTMLAnchorElement) { } } -export function download (data: Blob | string, downloadName = 'download') { +export function download(data: Blob | string, downloadName = 'download') { // using ideas from https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js if (!data) return; diff --git a/src/mol-util/file-info.ts b/src/mol-util/file-info.ts index 2c8247f367df0ef7a0a74b2502ba7afbb79decbe..f5f6dea678f3a17cb6b813511e92a5f7c7f29150 100644 --- a/src/mol-util/file-info.ts +++ b/src/mol-util/file-info.ts @@ -27,7 +27,7 @@ export interface FileInfo { src: FileInput } -export function getFileInfo (file: FileInput): FileInfo { +export function getFileInfo(file: FileInput): FileInfo { let path: string; let compressed: string|false; let protocol = ''; diff --git a/src/mol-util/graphql-client.ts b/src/mol-util/graphql-client.ts index 0e2f5eac731cadc5044267a566b8002747a24dfa..b4b8514045f11bc2fbe11f29714b6b968bf2d529 100644 --- a/src/mol-util/graphql-client.ts +++ b/src/mol-util/graphql-client.ts @@ -34,7 +34,7 @@ export class ClientError extends Error { response: GraphQLResponse request: GraphQLRequestContext - constructor (response: GraphQLResponse, request: GraphQLRequestContext) { + constructor(response: GraphQLResponse, request: GraphQLRequestContext) { const message = `${ClientError.extractMessage(response)}: ${JSON.stringify({ response, request })}`; super(message); @@ -48,7 +48,7 @@ export class ClientError extends Error { } } - private static extractMessage (response: GraphQLResponse): string { + private static extractMessage(response: GraphQLResponse): string { return response.errors ? response.errors[0].message : `GraphQL Error (Code: ${response.status})`; } } diff --git a/src/mol-util/input/event-offset.ts b/src/mol-util/input/event-offset.ts index 8d0858eedb55be2c3c1c530a207c1937e4f4fd6d..2bfbba869b2d093b244e68170df113dc0d16656c 100644 --- a/src/mol-util/input/event-offset.ts +++ b/src/mol-util/input/event-offset.ts @@ -13,7 +13,7 @@ import { Vec2 } from '../../mol-math/linear-algebra'; const rootPosition = { left: 0, top: 0 }; -export function eventOffset (out: Vec2, ev: MouseEvent | Touch, target: Element) { +export function eventOffset(out: Vec2, ev: MouseEvent | Touch, target: Element) { const cx = ev.clientX || 0; const cy = ev.clientY || 0; const rect = getBoundingClientOffset(target); @@ -22,7 +22,7 @@ export function eventOffset (out: Vec2, ev: MouseEvent | Touch, target: Element) return out; } -function getBoundingClientOffset (element: Element | Window | Document) { +function getBoundingClientOffset(element: Element | Window | Document) { if (element instanceof Window || element instanceof Document || element === document.body) { return rootPosition; } else { diff --git a/src/mol-util/polyfill.ts b/src/mol-util/polyfill.ts index 21ab1e0c449dffa02292bc28f13d26f06d7d05f0..496918f894b5c771e89f9b351738d79dd41c0927 100644 --- a/src/mol-util/polyfill.ts +++ b/src/mol-util/polyfill.ts @@ -84,14 +84,14 @@ if (!Math.sign) { if (!Number.isInteger) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger - Number.isInteger = function isInteger (nVal) { + Number.isInteger = function isInteger(nVal) { return typeof nVal === 'number' && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal; }; } if (!Number.isNaN) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN - Number.isNaN = function isNaN (value) { + Number.isNaN = function isNaN(value) { return value !== value; // eslint-disable-line no-self-compare }; } @@ -329,7 +329,7 @@ if (!Array.from) { }; // The length property of the from method is 1. - return function from (this: any, arrayLike: any/* , mapFn, thisArg */) { + return function from(this: any, arrayLike: any/* , mapFn, thisArg */) { // 1. Let C be the this value. const C = this; @@ -489,7 +489,7 @@ if (Object.defineProperty !== undefined) { } if (!Object.entries) { - Object.entries = function(obj: any){ + Object.entries = function (obj: any){ const ownProps = Object.keys(obj); let i = ownProps.length; const resArray = new Array(i); // preallocate the Array @@ -504,7 +504,7 @@ if (!Object.entries) { // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!Array.prototype.find) { Object.defineProperty(Array.prototype, 'find', { - value: function(predicate: any) { + value: function (predicate: any) { // 1. Let O be ? ToObject(this value). if (this == null) { throw TypeError('"this" is null or not defined'); @@ -551,7 +551,7 @@ if (!Array.prototype.find) { // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill if (!Array.prototype.fill) { Object.defineProperty(Array.prototype, 'fill', { - value: function(value: any) { + value: function (value: any) { // Steps 1-2. if (this == null) { @@ -596,7 +596,7 @@ if (!Array.prototype.fill) { if (!Array.prototype.copyWithin) { Object.defineProperty(Array.prototype, 'copyWithin', { - value: function(target: any, start: any/* , end*/) { + value: function (target: any, start: any/* , end*/) { // Steps 1-2. if (this == null) { throw new TypeError('this is null or not defined'); diff --git a/src/mol-util/read.ts b/src/mol-util/read.ts index 1b5aec57fdf1ea32eba269e5ccb08bafb428a7bd..fa38589ca95923598763ae094eddcbe41b198102 100644 --- a/src/mol-util/read.ts +++ b/src/mol-util/read.ts @@ -4,7 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -export function readFile (file: File, isBinary = false) { +export function readFile(file: File, isBinary = false) { const fileReader = new FileReader(); return new Promise<string | Uint8Array>((resolve, reject) => { fileReader.onerror = () => { diff --git a/src/mol-util/reference-cache.ts b/src/mol-util/reference-cache.ts index 6a8646e0acb2140d5ad619541a5cf7660d3d53c8..56acfc7bca5ed48b2314ea34c5462ee8509f7f0c 100644 --- a/src/mol-util/reference-cache.ts +++ b/src/mol-util/reference-cache.ts @@ -56,7 +56,7 @@ export function createReferenceCache<T, P>(hashFn: (props: P) => string, ctor: ( } }); }, - get count () { + get count() { return map.size; }, dispose: () => { diff --git a/src/mol-util/url.ts b/src/mol-util/url.ts index c78dc107160e65f307016675b1c300450dc212e6..31d6e831fe47979dfb2332c02b010deeee6bd680 100644 --- a/src/mol-util/url.ts +++ b/src/mol-util/url.ts @@ -4,7 +4,7 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -export function urlQueryParameter (id: string) { +export function urlQueryParameter(id: string) { if (typeof window === 'undefined') return undefined; const a = new RegExp(`${id}=([^&#=]*)`); const m = a.exec(window.location.search); diff --git a/src/mol-util/uuid.ts b/src/mol-util/uuid.ts index 1a25a5e37ee963220cb63bfb05ee4c3c72573e9a..ff47e06343c0e0e1d6d40ee049f8d762453c1f41 100644 --- a/src/mol-util/uuid.ts +++ b/src/mol-util/uuid.ts @@ -25,7 +25,7 @@ namespace UUID { export function createv4(): UUID { let d = (+new Date()) + now(); - const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); diff --git a/src/mol-util/zip/checksum.ts b/src/mol-util/zip/checksum.ts index 591370aeb32cfaa66a2dc196ab4cfff04e5dd14c..cd4d93fbd3105718632be7149ec1626e537d5bb5 100644 --- a/src/mol-util/zip/checksum.ts +++ b/src/mol-util/zip/checksum.ts @@ -7,7 +7,7 @@ * MIT License, Copyright (c) 2018 Photopea */ -const CrcTable = (function() { +const CrcTable = (function () { const tab = new Uint32Array(256); for (let n = 0; n < 256; n++) { let c = n; diff --git a/src/mol-util/zip/huffman.ts b/src/mol-util/zip/huffman.ts index dfebe8aa99607e33e8e9b747375354cc6108cc79..0ee6964e623173f81a35e004e7c43955d4cae2b0 100644 --- a/src/mol-util/zip/huffman.ts +++ b/src/mol-util/zip/huffman.ts @@ -32,7 +32,7 @@ export function _hufTree(hst: NumberArray, tree: number[], MAXL: number) { tree[(l2 << 1) + 1] = 1; return 1; } - list.sort(function(a, b){return a.f - b.f;}); + list.sort(function (a, b){return a.f - b.f;}); let a = list[0], b = list[1], i0 = 0, i1 = 1, i2 = 2; list[0] = { lit: -1, @@ -80,7 +80,7 @@ function setDepth(t: HufTree, d: number): number { function restrictDepth(dps: HufTree[], MD: number, maxl: number) { let i = 0, dbt = 0; const bCost = 1 << (maxl - MD); - dps.sort(function(a: HufTree, b: HufTree){return b.d === a.d ? a.f - b.f : b.d - a.d;}); + dps.sort(function (a: HufTree, b: HufTree){return b.d === a.d ? a.f - b.f : b.d - a.d;}); for(i = 0; i < dps.length; i++) { if(dps[i].d > MD) { diff --git a/src/mol-util/zip/util.ts b/src/mol-util/zip/util.ts index 45eb54ebb6ac10a1d0d7e7ef6cc9929cc92cc913..b60361d130f8a79586a750d333d72f0d90beab4c 100644 --- a/src/mol-util/zip/util.ts +++ b/src/mol-util/zip/util.ts @@ -7,7 +7,7 @@ * MIT License, Copyright (c) 2018 Photopea */ -export const U = (function(){ +export const U = (function (){ const u16 = Uint16Array, u32 = Uint32Array; return { next_code: new u16(16), @@ -33,7 +33,7 @@ export const U = (function(){ }; })(); -(function(){ +(function (){ const len = 1 << 15; for(let i = 0; i < len; i++) { let x = i; diff --git a/src/perf-tests/tasks.ts b/src/perf-tests/tasks.ts index 33b6260eef1321ac8c1b9027216c06d14aebb7e6..f853dcaa548458a0910fc8655378cc5ae9509a0d 100644 --- a/src/perf-tests/tasks.ts +++ b/src/perf-tests/tasks.ts @@ -158,7 +158,7 @@ export namespace Tasks { } } -(async function() { +(async function () { // await Tasks.testImmediate(); // await Tasks.testImmediate(); diff --git a/src/servers/model/server/api.ts b/src/servers/model/server/api.ts index 153a2753032520547661055ad6f617fcd1ac276e..70d864251a91f0cce71ba91094c0b67f4b333780 100644 --- a/src/servers/model/server/api.ts +++ b/src/servers/model/server/api.ts @@ -107,7 +107,7 @@ const AtomSiteTestJsonParam: QueryParamInfo = { exampleValues: [[{ label_seq_id: 30, label_asym_id: 'A' }, { label_seq_id: 31, label_asym_id: 'A' }], { label_comp_id: 'ALA' }] }; -export const AtomSiteTestRestParams = (function() { +export const AtomSiteTestRestParams = (function () { const params: QueryParamInfo[] = []; for (const k of Object.keys(AtomSiteSchemaElement)) { const p = (AtomSiteSchemaElement as any)[k] as QueryParamInfo;