Skip to content

Commit

Permalink
chore: remove some dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Aug 17, 2017
1 parent 86b4db4 commit 955ef71
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 43 deletions.
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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

17 changes: 3 additions & 14 deletions lib/utils/pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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
];
30 changes: 1 addition & 29 deletions tests/unit/pipes.spec.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 955ef71

Please sign in to comment.