Skip to content

nikmerlock97/ts-pipes

Repository files navigation

TS Pipes

GitHub license

Pipe transformation utility functions for TypeScript/JavaScript inspired by Angular Pipes and ngx-pipes

Table of contents

Installation

  1. 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.

About

Pipe transformation utility functions for JavaScript/TypeScript inspired by Angular Pipes and ngx-pipes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published