chore: remove some dead code

This commit is contained in:
Roman Hotsiy 2017-08-17 10:27:19 +03:00
parent 86b4db468b
commit 955ef7101d
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 35 additions and 43 deletions

31
.editorconfig Normal file
View 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

View File

@ -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' })
export class MarkedPipe implements PipeTransform {
renderer: MdRenderer;
@ -58,7 +47,7 @@ export class MarkedPipe implements PipeTransform {
transform(value:string) {
if (isBlank(value)) return 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>`;
return this.unstrustedSpec ? res : this.sanitizer.bypassSecurityTrustHtml(res);
@ -95,7 +84,7 @@ export class PrismPipe implements PipeTransform {
}
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
throw new InvalidPipeArgumentException(PrismPipe, value);
}
let lang = args[0].toString().trim().toLowerCase();
if (langMap[lang]) lang = langMap[lang];
@ -138,5 +127,5 @@ export class CollectionFormatPipe implements PipeTransform {
}
export const REDOC_PIPES = [
JsonPointerEscapePipe, MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe, JsonFormatter, KeysPipe, CollectionFormatPipe
MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe, JsonFormatter, KeysPipe, CollectionFormatPipe
];

View File

@ -1,6 +1,6 @@
'use strict';
import {KeysPipe, JsonPointerEscapePipe, MarkedPipe} from '../../lib/utils/pipes';
import {KeysPipe, MarkedPipe} from '../../lib/utils/pipes';
describe('Pipes', () => {
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', () => {
let unmarked;
let marked;