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

FullHuman / purgecss / 6677792066

28 Oct 2023 03:34PM UTC coverage: 92.031%. Remained the same
6677792066

push

github

web-flow
build(deps): bump typescript from 4.9.4 to 4.9.5 (#1159)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.4 to 4.9.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.4...v4.9.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

317 of 372 branches covered (0.0%)

Branch coverage included in aggregate %.

503 of 519 relevant lines covered (96.92%)

10603.71 hits per line

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

100.0
/packages/purgecss/src/ExtractorResultSets.ts
1
import { ExtractorResult } from "./types";
2

3
function mergeSets(into: Set<string>, from?: string[] | Set<string>): void {
4
  if (from) {
2,338✔
5
    from.forEach(into.add, into);
2,338✔
6
  }
7
}
8

9
/**
10
 * @public
11
 */
12
class ExtractorResultSets {
13
  private undetermined = new Set<string>();
420✔
14
  private attrNames = new Set<string>();
420✔
15
  private attrValues = new Set<string>();
420✔
16
  private classes = new Set<string>();
420✔
17
  private ids = new Set<string>();
420✔
18
  private tags = new Set<string>();
420✔
19

20
  constructor(er: ExtractorResult) {
21
    this.merge(er);
420✔
22
  }
23

24
  merge(that: ExtractorResult | ExtractorResultSets): this {
25
    if (Array.isArray(that)) {
738✔
26
      mergeSets(this.undetermined, that);
418✔
27
    } else if (that instanceof ExtractorResultSets) {
320✔
28
      mergeSets(this.undetermined, that.undetermined);
318✔
29
      mergeSets(this.attrNames, that.attrNames);
318✔
30
      mergeSets(this.attrValues, that.attrValues);
318✔
31
      mergeSets(this.classes, that.classes);
318✔
32
      mergeSets(this.ids, that.ids);
318✔
33
      mergeSets(this.tags, that.tags);
318✔
34
    } else {
35
      // ExtractorResultDetailed:
36
      mergeSets(this.undetermined, that.undetermined);
2✔
37
      if (that.attributes) {
2✔
38
        mergeSets(this.attrNames, that.attributes.names);
2✔
39
        mergeSets(this.attrValues, that.attributes.values);
2✔
40
      }
41
      mergeSets(this.classes, that.classes);
2✔
42
      mergeSets(this.ids, that.ids);
2✔
43
      mergeSets(this.tags, that.tags);
2✔
44
    }
45
    return this;
738✔
46
  }
47

48
  hasAttrName(name: string): boolean {
49
    return this.attrNames.has(name) || this.undetermined.has(name);
110✔
50
  }
51

52
  private someAttrValue(predicate: (value: string) => boolean): boolean {
53
    for (const val of this.attrValues) {
38✔
54
      if (predicate(val)) return true;
14✔
55
    }
56
    for (const val of this.undetermined) {
36✔
57
      if (predicate(val)) return true;
4,870✔
58
    }
59
    return false;
20✔
60
  }
61

62
  hasAttrPrefix(prefix: string): boolean {
63
    return this.someAttrValue((value) => value.startsWith(prefix));
302✔
64
  }
65

66
  hasAttrSuffix(suffix: string): boolean {
67
    return this.someAttrValue((value) => value.endsWith(suffix));
144✔
68
  }
69

70
  hasAttrSubstr(substr: string): boolean {
71
    const wordSubstr = substr.trim().split(" ");
16✔
72
    return wordSubstr.every((word) =>
16✔
73
      this.someAttrValue((value) => value.includes(word))
4,438✔
74
    );
75
  }
76

77
  hasAttrValue(value: string): boolean {
78
    return this.attrValues.has(value) || this.undetermined.has(value);
30✔
79
  }
80

81
  hasClass(name: string): boolean {
82
    return this.classes.has(name) || this.undetermined.has(name);
82,216✔
83
  }
84

85
  hasId(id: string): boolean {
86
    return this.ids.has(id) || this.undetermined.has(id);
10✔
87
  }
88

89
  hasTag(tag: string): boolean {
90
    return this.tags.has(tag) || this.undetermined.has(tag);
504✔
91
  }
92
}
93

94
export default ExtractorResultSets;
44✔
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

© 2025 Coveralls, Inc