clean: Replace enums with string or type and object
This commit is contained in:
parent
e772b26d1c
commit
fe8365bcc1
2 changed files with 35 additions and 21 deletions
|
|
@ -4,14 +4,22 @@ import { unifyPath, hashCode } from './utils';
|
|||
import * as rematch from './rematch';
|
||||
import { LineMatchingType, DiffStyleType, LineType, DiffLineParts, DiffFile, DiffFileName } from './types';
|
||||
|
||||
export enum CSSLineClass {
|
||||
INSERTS = 'd2h-ins',
|
||||
DELETES = 'd2h-del',
|
||||
CONTEXT = 'd2h-cntx',
|
||||
INFO = 'd2h-info',
|
||||
INSERT_CHANGES = 'd2h-ins d2h-change',
|
||||
DELETE_CHANGES = 'd2h-del d2h-change',
|
||||
}
|
||||
export type CSSLineClass =
|
||||
| 'd2h-ins'
|
||||
| 'd2h-del'
|
||||
| 'd2h-cntx'
|
||||
| 'd2h-info'
|
||||
| 'd2h-ins d2h-change'
|
||||
| 'd2h-del d2h-change';
|
||||
|
||||
export const CSSLineClass: { [_: string]: CSSLineClass } = {
|
||||
INSERTS: 'd2h-ins',
|
||||
DELETES: 'd2h-del',
|
||||
CONTEXT: 'd2h-cntx',
|
||||
INFO: 'd2h-info',
|
||||
INSERT_CHANGES: 'd2h-ins d2h-change',
|
||||
DELETE_CHANGES: 'd2h-del d2h-change',
|
||||
};
|
||||
|
||||
export type HighlightedLines = {
|
||||
oldLine: {
|
||||
|
|
|
|||
32
src/types.ts
32
src/types.ts
|
|
@ -69,18 +69,24 @@ export interface DiffFile extends DiffFileName {
|
|||
mode?: string;
|
||||
}
|
||||
|
||||
export enum OutputFormatType {
|
||||
LINE_BY_LINE = 'line-by-line',
|
||||
SIDE_BY_SIDE = 'side-by-side',
|
||||
}
|
||||
export type OutputFormatType = 'line-by-line' | 'side-by-side';
|
||||
|
||||
export enum LineMatchingType {
|
||||
LINES = 'lines',
|
||||
WORDS = 'words',
|
||||
NONE = 'none',
|
||||
}
|
||||
export const OutputFormatType: { [_: string]: OutputFormatType } = {
|
||||
LINE_BY_LINE: 'line-by-line',
|
||||
SIDE_BY_SIDE: 'side-by-side',
|
||||
};
|
||||
|
||||
export enum DiffStyleType {
|
||||
WORD = 'word',
|
||||
CHAR = 'char',
|
||||
}
|
||||
export type LineMatchingType = 'lines' | 'words' | 'none';
|
||||
|
||||
export const LineMatchingType: { [_: string]: LineMatchingType } = {
|
||||
LINES: 'lines',
|
||||
WORDS: 'words',
|
||||
NONE: 'none',
|
||||
};
|
||||
|
||||
export type DiffStyleType = 'word' | 'char';
|
||||
|
||||
export const DiffStyleType: { [_: string]: DiffStyleType } = {
|
||||
WORD: 'word',
|
||||
CHAR: 'char',
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue