
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ng2-string-replace-pipes
Advanced tools
a collection of handy string replacement pipes for angular 2.
a collection of handy string replacement pipes for angular 2.
extending StringReplacePipe:
// embolden text that should be emphasised semantically.
// wraps StringReplaceTemplatePipe and passes in a replace method.
import { Pipe, PipeTransform } from '@angular/core';
import { StringReplaceTemplatePipe } from './pipes';
@Pipe({ name: 'emphasis' })
export class EmphasisPipe implements PipeTransform {
replace(section: string): string {
return '<strong>' + section + '</strong>';
}
transform(str: string, words: RegExp[]): string {
return new StringReplaceTemplatePipe().transform(str, words, this.replace);
}
}
using the because the transform method in the above pipe takes an array of RegExp as a paremeter, it needs to be passed as a property
import { Component, OnInit } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app-emphasis',
template: `
<h1>Emphasis Works!</h1>
<pre [innerHtml]="templateString | emphasis:emphasisWords"></pre>
`
})
export class EmphasisComponent implements OnInit {
// used in my template
private emphasisWords: RegExp[] = [/for/, /and/, /or/];
private templateString: string = `
for this and that do A.
for all other situations, do B.
don't forget, to do C if A and B both fail.
instructions can be found at http://www.wikipedia.org/wiki/RTFM
u.s.a p.r.c. u.s.a.a. a.a.r.p
`;
ngOnInit() { }
}
FAQs
a collection of handy string replacement pipes for angular 2.
We found that ng2-string-replace-pipes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.