Merged PR 170: Add new eslint rules
- naming-convention - prefer-arrow-callback - func-style - import/no-default-export
This commit is contained in:
parent
3f58c5ba5e
commit
ad126c6c28
65 changed files with 781 additions and 784 deletions
|
@ -54,7 +54,7 @@ export function * MakeBFSIterator(root: IContainerModel): Generator<ContainerAnd
|
|||
* Returns the depth of the container
|
||||
* @returns The depth of the container
|
||||
*/
|
||||
export function getDepth(parent: IContainerModel): number {
|
||||
export function GetDepth(parent: IContainerModel): number {
|
||||
let depth = 0;
|
||||
|
||||
let current: IContainerModel | null = parent;
|
||||
|
@ -70,10 +70,10 @@ export function getDepth(parent: IContainerModel): number {
|
|||
* Returns the absolute position by iterating to the parent
|
||||
* @returns The absolute position of the container
|
||||
*/
|
||||
export function getAbsolutePosition(container: IContainerModel): [number, number] {
|
||||
export function GetAbsolutePosition(container: IContainerModel): [number, number] {
|
||||
const x = container.properties.x;
|
||||
const y = container.properties.y;
|
||||
return cancelParentTransform(container.parent, x, y);
|
||||
return CancelParentTransform(container.parent, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ export function getAbsolutePosition(container: IContainerModel): [number, number
|
|||
* @param y value to be restored
|
||||
* @returns x and y such that the transformations of the parent are cancelled
|
||||
*/
|
||||
export function cancelParentTransform(parent: IContainerModel | null, x: number, y: number): [number, number] {
|
||||
export function CancelParentTransform(parent: IContainerModel | null, x: number, y: number): [number, number] {
|
||||
let current = parent;
|
||||
while (current != null) {
|
||||
x += current.properties.x;
|
||||
|
@ -100,7 +100,7 @@ export function cancelParentTransform(parent: IContainerModel | null, x: number,
|
|||
* @param y value to be restored
|
||||
* @returns x and y such that the transformations of the parent are cancelled
|
||||
*/
|
||||
export function applyParentTransform(parent: IContainerModel | null, x: number, y: number): [number, number] {
|
||||
export function ApplyParentTransform(parent: IContainerModel | null, x: number, y: number): [number, number] {
|
||||
let current = parent;
|
||||
while (current != null) {
|
||||
x -= current.properties.x;
|
||||
|
@ -110,7 +110,7 @@ export function applyParentTransform(parent: IContainerModel | null, x: number,
|
|||
return [x, y];
|
||||
}
|
||||
|
||||
export function findContainerById(root: IContainerModel, id: string): IContainerModel | undefined {
|
||||
export function FindContainerById(root: IContainerModel, id: string): IContainerModel | undefined {
|
||||
const it = MakeIterator(root);
|
||||
for (const container of it) {
|
||||
if (container.properties.id === id) {
|
||||
|
@ -125,13 +125,13 @@ export interface IPair<T> {
|
|||
next: T
|
||||
}
|
||||
|
||||
export function * pairwise<T>(arr: T[]): Generator<IPair<T>, void, unknown> {
|
||||
export function * Pairwise<T>(arr: T[]): Generator<IPair<T>, void, unknown> {
|
||||
for (let i = 0; i < arr.length - 1; i++) {
|
||||
yield { cur: arr[i], next: arr[i + 1] };
|
||||
}
|
||||
}
|
||||
|
||||
export function * reversePairwise<T>(arr: T[]): Generator<IPair<T>, void, unknown> {
|
||||
export function * ReversePairwise<T>(arr: T[]): Generator<IPair<T>, void, unknown> {
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
yield { cur: arr[i], next: arr[i - 1] };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue