angular-pipes
angular-pipes is a pipes library for angular 2
. The project is hosted as angular-pipes
on npm
.
Contribute
Feel free to contribute in any way. Post your own pipes, fix bugs, add options to existing pipes, etc.
Pipes
You can find the documentations in the docs
folder.
Collections (array)
empty
head
initial
join
last
tail
uniq
without
range
map
pluck
where
orderBy
reverse
count
some
every
shuffle
take
drop
Boolean
greater
greaterOrEqual
less
lessOrEqual
equal
notEqual
identical
notIdentical
null
undefined
nil
number
string
function
array
object
defined
Math
Aggregate
String
leftpad
rightpad
pad
trim
split
replace
match
test
newlines
capitalize
upperfirst
template
encodeURI
encodeURIComponent
repeat
truncate
Object
Install
npm
npm install angular-pipes --save
jspm
jspm install angular-pipes=npm:angular-pipes
How to use
import { NG2_PIPES } from 'angular-pipes';
@Component({
// ...
pipes: [NG2_PIPES]
// ...
}}
You can also import only one category and a string pipe.
import { NG2_BOOLEAN_PIPES, SplitPipe } from 'angular-pipes';
@Component({
// ...
pipes: [NG2_BOOLEAN_PIPES, SplitPipe]
// ...
}}
But this will import all the files, you can do better by importing just the boolean files.
import { NG2_BOOLEAN_PIPES } from 'angular-pipes/pipes/boolean';
import { SplitPipe } from 'angular-pipes/pipes/string';
Same thing for the other categories.
And if you want to only include one file:
import { HeadPipe } from 'angular-pipes/pipes/src/array/head.pipe';
The boolean pipes are only in two files, the types are in types.pipe.ts
and the
conditions are in conditions.pipe.ts
If you only use one or two pipes, it's better to include only those two files. It will be lighter. There is no bundle available (everything in one file), this project let you bundle as you wish. But the compiled JS is available.
Tests
npm install
npm run lite
And navigate to /unit-tests.html
.
It may take some time for the files to transpile.
TODO
: Karma
Contributors
- Florian Knop