clean: Replace enums with string or type and object

This commit is contained in:
Rodrigo Fernandes 2020-01-25 23:49:17 +00:00
parent e772b26d1c
commit fe8365bcc1
No known key found for this signature in database
GPG key ID: 67157D2E3D4258B4
2 changed files with 35 additions and 21 deletions

View file

@ -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: {

View file

@ -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',
};