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

humanspeak / svelte-headless-table / 12913219917

22 Jan 2025 04:59PM UTC coverage: 59.766%. First build
12913219917

push

github

jaysin586
Rolling it way back

404 of 483 branches covered (83.64%)

Branch coverage included in aggregate %.

2232 of 3955 new or added lines in 55 files covered. (56.43%)

2616 of 4570 relevant lines covered (57.24%)

34.43 hits per line

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

0.0
/docs/src/lib/utils/createSamples.ts
NEW
1
import faker from 'faker';
×
NEW
2

×
NEW
3
export interface Sample {
×
NEW
4
  firstName: string;
×
NEW
5
  lastName: string;
×
NEW
6
  age: number;
×
NEW
7
  visits: number;
×
NEW
8
  progress: number;
×
NEW
9
  status: string;
×
NEW
10
  children?: Sample[];
×
NEW
11
}
×
NEW
12

×
NEW
13
export const createSamples = (...lengths: number[]) => {
×
NEW
14
  const createSamplesLevel = (depth = 0): Sample[] => {
×
NEW
15
    const length = lengths[depth];
×
NEW
16
    return [...Array(length)].map(() => {
×
NEW
17
      return {
×
NEW
18
        ...getSample(),
×
NEW
19
        ...(lengths[depth + 1] !== undefined ? { children: createSamplesLevel(depth + 1) } : {}),
×
NEW
20
      };
×
NEW
21
    });
×
NEW
22
  };
×
NEW
23
  return createSamplesLevel();
×
NEW
24
};
×
NEW
25

×
NEW
26
const getSample = (): Sample => {
×
NEW
27
  const statusChance = Math.random();
×
NEW
28
  return {
×
NEW
29
    firstName: faker.name.firstName(),
×
NEW
30
    lastName: faker.name.lastName(),
×
NEW
31
    age: Math.floor(Math.random() * 30),
×
NEW
32
    visits: Math.floor(Math.random() * 100),
×
NEW
33
    progress: Math.floor(Math.random() * 100),
×
NEW
34
    status: statusChance > 0.66 ? 'relationship' : statusChance > 0.33 ? 'complicated' : 'single',
×
NEW
35
  };
×
NEW
36
};
×
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