项目作者: nikmerlock97

项目描述 :
Pipe transformation utility functions for JavaScript/TypeScript inspired by Angular Pipes and ngx-pipes
高级语言: JavaScript
项目地址: git://github.com/nikmerlock97/ts-pipes.git
创建时间: 2021-02-02T06:40:05Z
项目社区:https://github.com/nikmerlock97/ts-pipes

开源协议:MIT License

下载


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

    1. $ npm install ts-pipes --save

Array

flatten

Usage:

  1. import Pipe from 'ts-pipes';
  2. const date = Pipe('date');
  3. const now = new Date();
  4. // timeAgo also supports moment.js objects
  5. const lastWeek = moment().subtract(10, 'days');
  1. <span>Updated: { date.timeAgo(now) }</span> <!-- Output: "just now" -->
  2. <span>Updated: { date.timeAgo(lastWeek) }</span> <!-- Output: "last week" -->

String

repeat()

Repeats a string n times

Usage: string | repeat: times: [separator|optional]

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