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

C2FO / fast-csv / 12025003900

26 Nov 2024 06:20AM CUT coverage: 95.889%. Remained the same
12025003900

push

github

web-flow
chore(deps): update dependency @types/node to v22.10.0 (#1067)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

321 of 349 branches covered (91.98%)

Branch coverage included in aggregate %.

752 of 770 relevant lines covered (97.66%)

2179022.73 hits per line

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

93.02
/packages/parse/src/ParserOptions.ts
1
import escapeRegExp from 'lodash.escaperegexp';
144✔
2
import isNil from 'lodash.isnil';
144✔
3
import { HeaderArray, HeaderTransformFunction } from './types';
4

5
export interface ParserOptionsArgs {
6
    objectMode?: boolean;
7
    delimiter?: string;
8
    quote?: string | null;
9
    escape?: string;
10
    headers?: boolean | HeaderTransformFunction | HeaderArray;
11
    renameHeaders?: boolean;
12
    ignoreEmpty?: boolean;
13
    comment?: string;
14
    strictColumnHandling?: boolean;
15
    discardUnmappedColumns?: boolean;
16
    trim?: boolean;
17
    ltrim?: boolean;
18
    rtrim?: boolean;
19
    encoding?: string;
20
    maxRows?: number;
21
    skipLines?: number;
22
    skipRows?: number;
23
}
24

25
export class ParserOptions {
144✔
26
    public readonly escapedDelimiter: string;
27

28
    public readonly objectMode: boolean = true;
2,220✔
29

30
    public readonly delimiter: string = ',';
2,220✔
31

32
    public readonly ignoreEmpty: boolean = false;
2,220✔
33

34
    public readonly quote: string | null = '"';
2,220✔
35

36
    public readonly escape: string | null = null;
2,220✔
37

38
    public readonly escapeChar: string | null = this.quote;
2,220✔
39

40
    public readonly comment: string | null = null;
2,220✔
41

42
    public readonly supportsComments: boolean = false;
2,220✔
43

44
    public readonly ltrim: boolean = false;
2,220✔
45

46
    public readonly rtrim: boolean = false;
2,220✔
47

48
    public readonly trim: boolean = false;
2,220✔
49

50
    public readonly headers: boolean | HeaderTransformFunction | HeaderArray | null = null;
2,220✔
51

52
    public readonly renameHeaders: boolean = false;
2,220✔
53

54
    public readonly strictColumnHandling: boolean = false;
2,220✔
55

56
    public readonly discardUnmappedColumns: boolean = false;
2,220✔
57

58
    public readonly carriageReturn: string = '\r';
2,220✔
59

60
    public readonly NEXT_TOKEN_REGEXP: RegExp;
61

62
    public readonly encoding: BufferEncoding = 'utf8';
2,220✔
63

64
    public readonly limitRows: boolean = false;
2,220✔
65

66
    public readonly maxRows: number = 0;
2,220✔
67

68
    public readonly skipLines: number = 0;
2,220✔
69

70
    public readonly skipRows: number = 0;
2,220✔
71

72
    public constructor(opts?: ParserOptionsArgs) {
73
        Object.assign(this, opts || {});
2,220✔
74
        if (this.delimiter.length > 1) {
2,220!
75
            throw new Error('delimiter option must be one character long');
×
76
        }
77
        this.escapedDelimiter = escapeRegExp(this.delimiter);
2,220✔
78
        this.escapeChar = this.escape ?? this.quote;
2,220✔
79
        this.supportsComments = !isNil(this.comment);
2,220✔
80
        this.NEXT_TOKEN_REGEXP = new RegExp(`([^\\s]|\\r\\n|\\n|\\r|${this.escapedDelimiter})`);
2,220✔
81

82
        if (this.maxRows > 0) {
2,220✔
83
            this.limitRows = true;
18✔
84
        }
85
    }
86
}
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