Pipe transformation utility functions for TypeScript/JavaScript inspired by Angular Pipes and ngx-pipes
- Use npm to install the package
$ npm install ts-pipes --save
Usage:
import Pipe from 'ts-pipes';
const date = Pipe('date');
const now = new Date();
// timeAgo also supports moment.js objects
const lastWeek = moment().subtract(10, 'days');
<span>Updated: { date.timeAgo(now) }</span> <!-- Output: "just now" -->
<span>Updated: { date.timeAgo(lastWeek) }</span> <!-- Output: "last week" -->
Repeats a string n times
Usage: string | repeat: times: [separator|optional]
<p>{{ 'example' | repeat: 3: '@' }}</p> <!-- Output: "example@example@example" -->
Forked from rollup-starter-lib.
Inspiration drawn from Angular pipes and ngx-pipes.
MIT License.