mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 08:36:33 +03:00
chore: remove some dead code
This commit is contained in:
parent
86b4db468b
commit
955ef7101d
31
.editorconfig
Normal file
31
.editorconfig
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
[*]
|
||||||
|
charset=utf-8
|
||||||
|
end_of_line=lf
|
||||||
|
insert_final_newline=false
|
||||||
|
indent_style=space
|
||||||
|
indent_size=4
|
||||||
|
|
||||||
|
[{.eslintrc,.babelrc,.stylelintrc,jest.config,*.json,*.jsb3,*.jsb2,*.bowerrc}]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
||||||
|
[*.scss]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
||||||
|
[*.styl]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
||||||
|
[*.coffee]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
||||||
|
[{.analysis_options,*.yml,*.yaml}]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
||||||
|
[tslint.json]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
|
|
@ -35,17 +35,6 @@ export class KeysPipe implements PipeTransform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Pipe({ name: 'jsonPointerEscape' })
|
|
||||||
export class JsonPointerEscapePipe implements PipeTransform {
|
|
||||||
transform(value:string) {
|
|
||||||
if (isBlank(value)) return value;
|
|
||||||
if (!isString(value)) {
|
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
|
||||||
}
|
|
||||||
return JsonPointer.escape(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Pipe({ name: 'marked' })
|
@Pipe({ name: 'marked' })
|
||||||
export class MarkedPipe implements PipeTransform {
|
export class MarkedPipe implements PipeTransform {
|
||||||
renderer: MdRenderer;
|
renderer: MdRenderer;
|
||||||
|
@ -58,7 +47,7 @@ export class MarkedPipe implements PipeTransform {
|
||||||
transform(value:string) {
|
transform(value:string) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
throw new InvalidPipeArgumentException(MarkedPipe, value);
|
||||||
}
|
}
|
||||||
let res = `<span class="redoc-markdown-block">${this.renderer.renderMd(value)}</span>`;
|
let res = `<span class="redoc-markdown-block">${this.renderer.renderMd(value)}</span>`;
|
||||||
return this.unstrustedSpec ? res : this.sanitizer.bypassSecurityTrustHtml(res);
|
return this.unstrustedSpec ? res : this.sanitizer.bypassSecurityTrustHtml(res);
|
||||||
|
@ -95,7 +84,7 @@ export class PrismPipe implements PipeTransform {
|
||||||
}
|
}
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(value)) {
|
if (!isString(value)) {
|
||||||
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
|
throw new InvalidPipeArgumentException(PrismPipe, value);
|
||||||
}
|
}
|
||||||
let lang = args[0].toString().trim().toLowerCase();
|
let lang = args[0].toString().trim().toLowerCase();
|
||||||
if (langMap[lang]) lang = langMap[lang];
|
if (langMap[lang]) lang = langMap[lang];
|
||||||
|
@ -138,5 +127,5 @@ export class CollectionFormatPipe implements PipeTransform {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const REDOC_PIPES = [
|
export const REDOC_PIPES = [
|
||||||
JsonPointerEscapePipe, MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe, JsonFormatter, KeysPipe, CollectionFormatPipe
|
MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe, JsonFormatter, KeysPipe, CollectionFormatPipe
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {KeysPipe, JsonPointerEscapePipe, MarkedPipe} from '../../lib/utils/pipes';
|
import {KeysPipe, MarkedPipe} from '../../lib/utils/pipes';
|
||||||
|
|
||||||
describe('Pipes', () => {
|
describe('Pipes', () => {
|
||||||
describe('KeysPipe', () => {
|
describe('KeysPipe', () => {
|
||||||
|
@ -33,34 +33,6 @@ describe('Pipes', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('JsonPointerEscapePipe', () => {
|
|
||||||
let unescaped;
|
|
||||||
let escaped;
|
|
||||||
var pipe;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
unescaped = 'test/path~1';
|
|
||||||
escaped = 'test~1path~01';
|
|
||||||
pipe = new JsonPointerEscapePipe();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('JsonPointerEscapePipe transform', () => {
|
|
||||||
it('should escpae pointer', () => {
|
|
||||||
var val = pipe.transform(unescaped);
|
|
||||||
val.should.be.equal(escaped);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not support other objects', () => {
|
|
||||||
(() => pipe.transform(45)).should.throw();
|
|
||||||
(() => pipe.transform({})).should.throw();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not throw on blank input', () => {
|
|
||||||
(() => pipe.transform()).should.not.throw();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('MarkedPipe', () => {
|
describe('MarkedPipe', () => {
|
||||||
let unmarked;
|
let unmarked;
|
||||||
let marked;
|
let marked;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user