Comparing version 0.4.7 to 0.4.8
import { PipeTransform } from '@angular/core'; | ||
export declare class InitialPipe implements PipeTransform { | ||
transform(arr: any[], [num]?: number[]): any[]; | ||
transform(arr: any[], num?: number): any[]; | ||
} |
@@ -15,4 +15,4 @@ "use strict"; | ||
} | ||
InitialPipe.prototype.transform = function (arr, _a) { | ||
var _b = (_a === void 0 ? [] : _a)[0], num = _b === void 0 ? 0 : _b; | ||
InitialPipe.prototype.transform = function (arr, num) { | ||
if (num === void 0) { num = 0; } | ||
return arr instanceof Array | ||
@@ -19,0 +19,0 @@ ? arr.slice(0, arr.length - num) |
{ | ||
"name": "ng2-pipes", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"author": "Dan Revah", | ||
@@ -5,0 +5,0 @@ "description": "Useful angular2 pipes", |
170
README.md
@@ -210,3 +210,3 @@ # Angular2 Pipes | ||
```html | ||
<li *ngFor="let item of items | diff: [[1, 2]]"> <-- Array: [3, 4] --> | ||
<li *ngFor="let item of items | diff: [1, 2]"> <!-- Array: [3, 4] --> | ||
``` | ||
@@ -226,3 +226,3 @@ | ||
<li *ngFor="let item of items | flatten"> | ||
<-- Array: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] --> | ||
<!-- Array: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] --> | ||
``` | ||
@@ -241,3 +241,3 @@ | ||
```html | ||
<li *ngFor="let item of items | initial: 1"> <-- Array: [first, second] --> | ||
<li *ngFor="let item of items | initial: 1"> <!-- Array: [first, second] --> | ||
``` | ||
@@ -256,3 +256,3 @@ | ||
```html | ||
<li *ngFor="let item of items | tail: 1"> <-- Array: [second, third] --> | ||
<li *ngFor="let item of items | tail: 1"> <!-- Array: [second, third] --> | ||
``` | ||
@@ -271,3 +271,3 @@ | ||
```html | ||
<li *ngFor="let item of items | intersection: [1, 2]: [3, 6]"> <-- Array: [1, 2, 3] --> | ||
<li *ngFor="let item of items | intersection: [1, 2]: [3, 6]"> <!-- Array: [1, 2, 3] --> | ||
``` | ||
@@ -286,3 +286,3 @@ | ||
```html | ||
<li *ngFor="let item of items | reverse"> <-- Array: [3, 2, 1] --> | ||
<li *ngFor="let item of items | reverse"> <!-- Array: [3, 2, 1] --> | ||
``` | ||
@@ -301,3 +301,3 @@ | ||
```html | ||
<li *ngFor="let item of items | truthify"> <-- Array: [1, 2, 3, 4] --> | ||
<li *ngFor="let item of items | truthify"> <!-- Array: [1, 2, 3, 4] --> | ||
``` | ||
@@ -316,3 +316,3 @@ | ||
```html | ||
<li *ngFor="let item of items | union: [[4]]"> <-- Array: [1, 2, 3, 4] --> | ||
<li *ngFor="let item of items | union: [[4]]"> <!-- Array: [1, 2, 3, 4] --> | ||
``` | ||
@@ -331,3 +331,3 @@ | ||
```html | ||
<li *ngFor="let item of items | unique"> <-- Array: [1, 2, 3] --> | ||
<li *ngFor="let item of items | unique"> <!-- Array: [1, 2, 3] --> | ||
``` | ||
@@ -346,3 +346,3 @@ | ||
```html | ||
<li *ngFor="let item of items | without: [1,3]"> <-- Array: [2, 2] --> | ||
<li *ngFor="let item of items | without: [1,3]"> <!-- Array: [2, 2] --> | ||
``` | ||
@@ -380,4 +380,4 @@ | ||
```html | ||
<li *ngFor="let item of items | pluck: 'a'"> <-- Array: [1, 2, 3] --> | ||
<li *ngFor="let item of items | pluck: 'b.c'"> <-- Array: [4, 5, 6] --> | ||
<li *ngFor="let item of items | pluck: 'a'"> <!-- Array: [1, 2, 3] --> | ||
<li *ngFor="let item of items | pluck: 'b.c'"> <!-- Array: [4, 5, 6] --> | ||
``` | ||
@@ -396,3 +396,3 @@ | ||
```html | ||
<li *ngFor="let item of items | shuffle"> <-- Array: [4, 1, 6, 2, 5, 3] --> | ||
<li *ngFor="let item of items | shuffle"> <!-- Array: [4, 1, 6, 2, 5, 3] --> | ||
``` | ||
@@ -416,5 +416,5 @@ | ||
```html | ||
<p>{{ itemsOne | every: predicate }}</p> <-- Output: "true" --> | ||
<p>{{ itemsTwo | every: predicate }}</p> <-- Output: "false" --> | ||
<p>{{ itemsThree | every: predicate }}</p> <-- Output: "false" --> | ||
<p>{{ itemsOne | every: predicate }}</p> <!-- Output: "true" --> | ||
<p>{{ itemsTwo | every: predicate }}</p> <!-- Output: "false" --> | ||
<p>{{ itemsThree | every: predicate }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -438,5 +438,5 @@ | ||
```html | ||
<p>{{ itemsOne | some: predicate }}</p> <-- Output: "true" --> | ||
<p>{{ itemsTwo | some: predicate }}</p> <-- Output: "true" --> | ||
<p>{{ itemsThree | some: predicate }}</p> <-- Output: "false" --> | ||
<p>{{ itemsOne | some: predicate }}</p> <!-- Output: "true" --> | ||
<p>{{ itemsTwo | some: predicate }}</p> <!-- Output: "true" --> | ||
<p>{{ itemsThree | some: predicate }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -451,4 +451,4 @@ | ||
```html | ||
<p>{{ [1, 2, 3, 4] | sample }}</p> <-- Output: "[2]" --> | ||
<p>{{ [1, 2, 3, 4] | sample: 2 }}</p> <-- Output: "[4, 3]" --> | ||
<p>{{ [1, 2, 3, 4] | sample }}</p> <!-- Output: "[2]" --> | ||
<p>{{ [1, 2, 3, 4] | sample: 2 }}</p> <!-- Output: "[4, 3]" --> | ||
``` | ||
@@ -465,3 +465,3 @@ | ||
```html | ||
<p>{{ [1, 2, 3, 1, 2, 3] | min }}</p> <-- Output: "1" --> | ||
<p>{{ [1, 2, 3, 1, 2, 3] | min }}</p> <!-- Output: "1" --> | ||
``` | ||
@@ -476,3 +476,3 @@ | ||
```html | ||
<p>{{ [1, 2, 3, 1, 2, 3] | max }}</p> <-- Output: "3" --> | ||
<p>{{ [1, 2, 3, 1, 2, 3] | max }}</p> <!-- Output: "3" --> | ||
``` | ||
@@ -487,3 +487,3 @@ | ||
```html | ||
<p>{{ [1, 2, 3, 4] | sum }}</p> <-- Output: "10" --> | ||
<p>{{ [1, 2, 3, 4] | sum }}</p> <!-- Output: "10" --> | ||
``` | ||
@@ -498,5 +498,5 @@ | ||
```html | ||
<p>{{ 5 | percentage }}</p> <-- Output: "5" --> | ||
<p>{{ 5 | percentage: 160 }}</p> <-- Output: "3.125" --> | ||
<p>{{ 5 | percentage: 160: true }}</p> <-- Output: "3" --> | ||
<p>{{ 5 | percentage }}</p> <!-- Output: "5" --> | ||
<p>{{ 5 | percentage: 160 }}</p> <!-- Output: "3.125" --> | ||
<p>{{ 5 | percentage: 160: true }}</p> <!-- Output: "3" --> | ||
``` | ||
@@ -511,4 +511,4 @@ | ||
```html | ||
<p>{{ 42.123 | ceil }}</p> <-- Output: "43" --> | ||
<p>{{ 42.123 | ceil: 2 }}</p> <-- Output: "42.13" --> | ||
<p>{{ 42.123 | ceil }}</p> <!-- Output: "43" --> | ||
<p>{{ 42.123 | ceil: 2 }}</p> <!-- Output: "42.13" --> | ||
``` | ||
@@ -523,4 +523,4 @@ | ||
```html | ||
<p>{{ 42.123 | floor }}</p> <-- Output: "42" --> | ||
<p>{{ 42.123 | floor: 2 }}</p> <-- Output: "42.12" --> | ||
<p>{{ 42.123 | floor }}</p> <!-- Output: "42" --> | ||
<p>{{ 42.123 | floor: 2 }}</p> <!-- Output: "42.12" --> | ||
``` | ||
@@ -535,5 +535,5 @@ | ||
```html | ||
<p>{{ 42.4 | round }}</p> <-- Output: "42" --> | ||
<p>{{ 42.5 | round }}</p> <-- Output: "43" --> | ||
<p>{{ 42.123 | round: 2 }}</p> <-- Output: "42.12" --> | ||
<p>{{ 42.4 | round }}</p> <!-- Output: "42" --> | ||
<p>{{ 42.5 | round }}</p> <!-- Output: "43" --> | ||
<p>{{ 42.123 | round: 2 }}</p> <!-- Output: "42.12" --> | ||
``` | ||
@@ -548,3 +548,3 @@ | ||
```html | ||
<p>{{ 9 | sqrt }}</p> <-- Output: "3" --> | ||
<p>{{ 9 | sqrt }}</p> <!-- Output: "3" --> | ||
``` | ||
@@ -559,4 +559,4 @@ | ||
```html | ||
<p>{{ 3 | pow }}</p> <-- Output: "9" --> | ||
<p>{{ 3 | pow: 3 }}</p> <-- Output: "27" --> | ||
<p>{{ 3 | pow }}</p> <!-- Output: "9" --> | ||
<p>{{ 3 | pow: 3 }}</p> <!-- Output: "27" --> | ||
``` | ||
@@ -571,3 +571,3 @@ | ||
```html | ||
<p>{{ 3.141592653589793 | degrees }}</p> <-- Output: "180" --> | ||
<p>{{ 3.141592653589793 | degrees }}</p> <!-- Output: "180" --> | ||
``` | ||
@@ -582,3 +582,3 @@ | ||
```html | ||
<p>{{ 180 | radians }}</p> <-- Output: "3.141592653589793" --> | ||
<p>{{ 180 | radians }}</p> <!-- Output: "3.141592653589793" --> | ||
``` | ||
@@ -593,6 +593,6 @@ | ||
```html | ||
<p>{{ 10 | bytes }}</p> <-- Output: "1 B" --> | ||
<p>{{ 1000 | bytes }}</p> <-- Output: "1 KB" --> | ||
<p>{{ 1000000 | bytes }}</p> <-- Output: "1 MB" --> | ||
<p>{{ 1000000000 | bytes }}</p> <-- Output: "1 GB" --> | ||
<p>{{ 10 | bytes }}</p> <!-- Output: "1 B" --> | ||
<p>{{ 1000 | bytes }}</p> <!-- Output: "1 KB" --> | ||
<p>{{ 1000000 | bytes }}</p> <!-- Output: "1 MB" --> | ||
<p>{{ 1000000000 | bytes }}</p> <!-- Output: "1 GB" --> | ||
``` | ||
@@ -607,4 +607,4 @@ | ||
```html | ||
<p>{{ null | isNull }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isNull }}</p> <-- Output: "false" --> | ||
<p>{{ null | isNull }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isNull }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -617,4 +617,4 @@ | ||
```html | ||
<p>{{ 1 | isDefined }}</p> <-- Output: "true" --> | ||
<p>{{ undefined | isDefined }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isDefined }}</p> <!-- Output: "true" --> | ||
<p>{{ undefined | isDefined }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -627,4 +627,4 @@ | ||
```html | ||
<p>{{ 1 | isUndefined }}</p> <-- Output: "false" --> | ||
<p>{{ undefined | isUndefined }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isUndefined }}</p> <!-- Output: "false" --> | ||
<p>{{ undefined | isUndefined }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -638,4 +638,4 @@ | ||
```html | ||
<p>{{ 1 | isString }}</p> <-- Output: "false" --> | ||
<p>{{ '' | isString }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isString }}</p> <!-- Output: "false" --> | ||
<p>{{ '' | isString }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -653,4 +653,4 @@ | ||
```html | ||
<p>{{ num | isNumber }}</p> <-- Output: "true" --> | ||
<p>{{ func | isNumber }}</p> <-- Output: "false" --> | ||
<p>{{ num | isNumber }}</p> <!-- Output: "true" --> | ||
<p>{{ func | isNumber }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -668,4 +668,4 @@ | ||
```html | ||
<p>{{ num | isArray }}</p> <-- Output: "false" --> | ||
<p>{{ arr | isArray }}</p> <-- Output: "true" --> | ||
<p>{{ num | isArray }}</p> <!-- Output: "false" --> | ||
<p>{{ arr | isArray }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -683,4 +683,4 @@ | ||
```html | ||
<p>{{ num | isObject }}</p> <-- Output: "false" --> | ||
<p>{{ obj | isObject }}</p> <-- Output: "true" --> | ||
<p>{{ num | isObject }}</p> <!-- Output: "false" --> | ||
<p>{{ obj | isObject }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -693,5 +693,5 @@ | ||
```html | ||
<p>{{ 1 | isGreaterThan: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isGreaterThan: 2 }}</p> <-- Output: "false" --> | ||
<p>{{ 2 | isGreaterThan: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isGreaterThan: 1 }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isGreaterThan: 2 }}</p> <!-- Output: "false" --> | ||
<p>{{ 2 | isGreaterThan: 1 }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -704,5 +704,5 @@ | ||
```html | ||
<p>{{ 1 | isGreaterEqualThan: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isGreaterEqualThan: 2 }}</p> <-- Output: "false" --> | ||
<p>{{ 2 | isGreaterEqualThan: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isGreaterEqualThan: 1 }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isGreaterEqualThan: 2 }}</p> <!-- Output: "false" --> | ||
<p>{{ 2 | isGreaterEqualThan: 1 }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -715,5 +715,5 @@ | ||
```html | ||
<p>{{ 1 | isLessThan: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isLessThan: 2 }}</p> <-- Output: "true" --> | ||
<p>{{ 2 | isLessThan: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isLessThan: 1 }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isLessThan: 2 }}</p> <!-- Output: "true" --> | ||
<p>{{ 2 | isLessThan: 1 }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -726,5 +726,5 @@ | ||
```html | ||
<p>{{ 1 | isLessEqualThan: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isLessEqualThan: 2 }}</p> <-- Output: "true" --> | ||
<p>{{ 2 | isLessEqualThan: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isLessEqualThan: 1 }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isLessEqualThan: 2 }}</p> <!-- Output: "true" --> | ||
<p>{{ 2 | isLessEqualThan: 1 }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -737,6 +737,6 @@ | ||
```html | ||
<p>{{ 1 | isEqualTo: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isEqualTo: '1' }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isEqualTo: 2 }}</p> <-- Output: "false" --> | ||
<p>{{ 2 | isEqualTo: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isEqualTo: 1 }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isEqualTo: '1' }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isEqualTo: 2 }}</p> <!-- Output: "false" --> | ||
<p>{{ 2 | isEqualTo: 1 }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -749,6 +749,6 @@ | ||
```html | ||
<p>{{ 1 | isNotEqualTo: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isNotEqualTo: '1' }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isNotEqualTo: 2 }}</p> <-- Output: "true" --> | ||
<p>{{ 2 | isNotEqualTo: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isNotEqualTo: 1 }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isNotEqualTo: '1' }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isNotEqualTo: 2 }}</p> <!-- Output: "true" --> | ||
<p>{{ 2 | isNotEqualTo: 1 }}</p> <!-- Output: "true" --> | ||
``` | ||
@@ -761,6 +761,6 @@ | ||
```html | ||
<p>{{ 1 | isIdenticalTo: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isIdenticalTo: '1' }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isIdenticalTo: 2 }}</p> <-- Output: "false" --> | ||
<p>{{ 2 | isIdenticalTo: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isIdenticalTo: 1 }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isIdenticalTo: '1' }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isIdenticalTo: 2 }}</p> <!-- Output: "false" --> | ||
<p>{{ 2 | isIdenticalTo: 1 }}</p> <!-- Output: "false" --> | ||
``` | ||
@@ -773,6 +773,6 @@ | ||
```html | ||
<p>{{ 1 | isNotIdenticalTo: 1 }}</p> <-- Output: "false" --> | ||
<p>{{ 1 | isNotIdenticalTo: '1' }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isNotIdenticalTo: 2 }}</p> <-- Output: "true" --> | ||
<p>{{ 2 | isNotIdenticalTo: 1 }}</p> <-- Output: "true" --> | ||
<p>{{ 1 | isNotIdenticalTo: 1 }}</p> <!-- Output: "false" --> | ||
<p>{{ 1 | isNotIdenticalTo: '1' }}</p> <!-- Output: "true" --> | ||
<p>{{ 1 | isNotIdenticalTo: 2 }}</p> <!-- Output: "true" --> | ||
<p>{{ 2 | isNotIdenticalTo: 1 }}</p> <!-- Output: "true" --> | ||
``` |
@@ -7,3 +7,3 @@ import {PipeTransform, Pipe, Injectable} from '@angular/core'; | ||
transform(arr: any[], [num = 0]: number[] = []): any[] | ||
transform(arr: any[], num: number = 0): any[] | ||
{ | ||
@@ -10,0 +10,0 @@ return arr instanceof Array |
Sorry, the diff of this file is not supported yet
238356