0.1.47 • Published 2 years ago
ts-pipes v0.1.47
TS Pipes
Pipe transformation utility functions for TypeScript/JavaScript inspired by Angular Pipes and ngx-pipes
Table of contents
Installation
Use npm to install the package
$ npm install ts-pipes --save
Array
flatten
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" -->
String
repeat()
Repeats a string n times
Usage: string | repeat: times: [separator|optional]
<p>{{ 'example' | repeat: 3: '@' }}</p> <!-- Output: "example@example@example" -->
License
Forked from rollup-starter-lib.
Inspiration drawn from Angular pipes and ngx-pipes.
MIT License.