Comparing version 0.3.7 to 0.3.8
import { PipeTransform } from '@angular/core'; | ||
export declare class StripTagsPipe implements PipeTransform { | ||
transform(text: string, [allowedTags]?: any[]): string; | ||
transform(text: string, ...allowedTags: any[]): string; | ||
} |
@@ -15,4 +15,7 @@ "use strict"; | ||
} | ||
StripTagsPipe.prototype.transform = function (text, _a) { | ||
var _b = (_a === void 0 ? [] : _a)[0], allowedTags = _b === void 0 ? [] : _b; | ||
StripTagsPipe.prototype.transform = function (text) { | ||
var allowedTags = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
allowedTags[_i - 1] = arguments[_i]; | ||
} | ||
return allowedTags.length > 0 | ||
@@ -19,0 +22,0 @@ ? text.replace(new RegExp("<(?!/?(" + allowedTags.join('|') + ")s*/?)[^>]+>", 'g'), '') |
{ | ||
"name": "ng2-pipes", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"author": "Dan Revah", | ||
@@ -16,4 +16,14 @@ "description": "Useful angular2 pipes", | ||
"keywords": [ | ||
"ng2", "ng", "angular", "angular2", "angularjs", "pipes", "filters", "library", | ||
"angular2 pipes", "ng2 pipes", "angular filters", "angular pipes" | ||
"ng2", | ||
"ng", | ||
"angular", | ||
"angular2", | ||
"angularjs", | ||
"pipes", | ||
"filters", | ||
"library", | ||
"angular2 pipes", | ||
"ng2 pipes", | ||
"angular filters", | ||
"angular pipes" | ||
], | ||
@@ -20,0 +30,0 @@ "repository": { |
@@ -7,7 +7,7 @@ import {PipeTransform, Pipe, Injectable} from '@angular/core'; | ||
transform(text:string, ...allowedTags: any[]):string { | ||
transform(text: string, ...allowedTags: any[]): string { | ||
return allowedTags.length > 0 | ||
? text.replace(new RegExp(`<(?!\/?(${allowedTags.join('|')})\s*\/?)[^>]+>`, 'g'), '') | ||
: text.replace(/<(?:.|\s)*?>/g, ''); | ||
? text.replace(new RegExp(`<(?!\/?(${allowedTags.join('|')})\s*\/?)[^>]+>`, 'g'), '') | ||
: text.replace(/<(?:.|\s)*?>/g, ''); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
214253
3513