Skip to content

Commit

Permalink
feat(package): added linkify pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Jul 23, 2018
1 parent 72377a2 commit 98f4b7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/module/pipes/ngx-linkifyjs.pipe.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NgxLinkifyjsPipe } from './ngx-linkifyjs.pipe';

describe('NgxLinkifyjsPipe', () => {
it('create an instance', () => {
const pipe = new NgxLinkifyjsPipe();
expect(pipe).toBeTruthy();
});
});
14 changes: 14 additions & 0 deletions src/module/pipes/ngx-linkifyjs.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Pipe, PipeTransform} from '@angular/core';
// @ts-ignore
import linkifyStr from 'linkifyjs/string';

@Pipe({
name: 'linkify'
})
export class NgxLinkifyjsPipe implements PipeTransform {

transform(value: any, args?: any): string {
return value ? linkifyStr(value, {target: '_system'}) : value;
}

}

0 comments on commit 98f4b7d

Please sign in to comment.