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 * as rematch from './rematch';
|
||||||
import { LineMatchingType, DiffStyleType, LineType, DiffLineParts, DiffFile, DiffFileName } from './types';
|
import { LineMatchingType, DiffStyleType, LineType, DiffLineParts, DiffFile, DiffFileName } from './types';
|
||||||
|
|
||||||
export enum CSSLineClass {
|
export type CSSLineClass =
|
||||||
INSERTS = 'd2h-ins',
|
| 'd2h-ins'
|
||||||
DELETES = 'd2h-del',
|
| 'd2h-del'
|
||||||
CONTEXT = 'd2h-cntx',
|
| 'd2h-cntx'
|
||||||
INFO = 'd2h-info',
|
| 'd2h-info'
|
||||||
INSERT_CHANGES = 'd2h-ins d2h-change',
|
| 'd2h-ins d2h-change'
|
||||||
DELETE_CHANGES = 'd2h-del 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 = {
|
export type HighlightedLines = {
|
||||||
oldLine: {
|
oldLine: {
|
||||||
|
|
|
||||||
32
src/types.ts
32
src/types.ts
|
|
@ -69,18 +69,24 @@ export interface DiffFile extends DiffFileName {
|
||||||
mode?: string;
|
mode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum OutputFormatType {
|
export type OutputFormatType = 'line-by-line' | 'side-by-side';
|
||||||
LINE_BY_LINE = 'line-by-line',
|
|
||||||
SIDE_BY_SIDE = 'side-by-side',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum LineMatchingType {
|
export const OutputFormatType: { [_: string]: OutputFormatType } = {
|
||||||
LINES = 'lines',
|
LINE_BY_LINE: 'line-by-line',
|
||||||
WORDS = 'words',
|
SIDE_BY_SIDE: 'side-by-side',
|
||||||
NONE = 'none',
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export enum DiffStyleType {
|
export type LineMatchingType = 'lines' | 'words' | 'none';
|
||||||
WORD = 'word',
|
|
||||||
CHAR = 'char',
|
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