• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 15948993626

28 Jun 2025 09:54PM UTC coverage: 73.423% (-4.5%) from 77.956%
15948993626

push

github

apowers313
build: add package linting and remove unused packages

254 of 356 branches covered (71.35%)

Branch coverage included in aggregate %.

1992 of 2703 relevant lines covered (73.7%)

462.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/layout/ArfLayoutEngine.ts
1
import {arfLayout, Edge as LayoutEdge, Node as LayoutNode} from "@graphty/layout";
1✔
2
import {z} from "zod/v4";
1✔
3

4
import {SimpleLayoutConfig, SimpleLayoutEngine} from "./LayoutEngine";
1✔
5

6
export const ArfLayoutConfig = z.strictObject({
1✔
7
    ... SimpleLayoutConfig.shape,
1✔
8
    pos: z.record(
1✔
9
        z.number(),
1✔
10
        z.array(z.number()),
1✔
11
    ).or(z.null()).default(null),
1✔
12
    scaling: z.number().positive().default(1),
1✔
13
    a: z.number().positive().default(1.1),
1✔
14
    maxIter: z.number().positive().default(1000),
1✔
15
    seed: z.number().positive().or(z.null()).default(null),
1✔
16
});
1✔
17
export type ArfLayoutConfigType = z.infer<typeof ArfLayoutConfig>;
18
export type ArfLayoutOpts = Partial<ArfLayoutConfigType>;
19

20
export class ArfLayout extends SimpleLayoutEngine {
1✔
21
    static type = "arf";
1✔
22
    scalingFactor = 100;
1✔
23
    config: ArfLayoutConfigType;
24

25
    constructor(opts: ArfLayoutOpts) {
1✔
26
        super(opts);
1✔
27
        this.config = ArfLayoutConfig.parse(opts);
1✔
28
    }
1✔
29

30
    doLayout(): void {
1✔
31
        this.stale = false;
×
32
        const nodes = () => this._nodes.map((n) => n.id as LayoutNode);
×
33
        const edges = () => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
×
34

35
        this.positions = arfLayout(
×
36
            {nodes, edges},
×
37
            this.config.pos,
×
38
            this.config.scaling,
×
39
            this.config.a,
×
40
            this.config.maxIter,
×
41
            this.config.seed,
×
42
        );
×
43
    }
×
44
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc