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

hexojs / hexo / 5138716819

pending completion
5138716819

push

github

web-flow
chore: change dependencies version (#5202)

* chore: change dependencies version

* chore: ignore pnpm lock file

2209 of 2331 branches covered (94.77%)

8750 of 8868 relevant lines covered (98.67%)

53.71 hits per line

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

96.61
/lib/extend/processor.ts
1
import Promise from 'bluebird';
1✔
2
import { Pattern } from 'hexo-util';
1✔
3
import type File from '../box/file';
1✔
4

1✔
5
interface StoreFunction {
1✔
6
  (file: File): any
1✔
7
}
1✔
8

1✔
9
type Store = {
1✔
10
    pattern: Pattern;
1✔
11
    process: StoreFunction
1✔
12
  }[];
1✔
13

1✔
14
type patternType = Exclude<ConstructorParameters<typeof Pattern>[0], ((str: string) => string)>;
1✔
15
class Processor {
1✔
16
  public store: Store;
1✔
17

1✔
18
  constructor() {
1✔
19
    this.store = [];
145✔
20
  }
145✔
21

1✔
22
  list() {
1✔
23
    return this.store;
162✔
24
  }
162✔
25

1✔
26
  register(fn: StoreFunction): void;
1✔
27
  register(pattern: patternType, fn: StoreFunction): void;
1✔
28
  register(pattern: patternType | StoreFunction, fn?: StoreFunction) {
1✔
29
    if (!fn) {
205✔
30
      if (typeof pattern === 'function') {
2✔
31
        fn = pattern;
1✔
32
        pattern = /(.*)/;
1✔
33
      } else {
1✔
34
        throw new TypeError('fn must be a function');
1✔
35
      }
1✔
36
    }
2✔
37

204✔
38
    if (fn.length > 1) {
205!
39
      fn = Promise.promisify(fn);
×
40
    } else {
205✔
41
      fn = Promise.method(fn);
204✔
42
    }
204✔
43

204✔
44
    this.store.push({
204✔
45
      pattern: new Pattern(pattern as patternType),
204✔
46
      process: fn
204✔
47
    });
204✔
48
  }
204✔
49
}
1✔
50

1✔
51
export = Processor;
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