angular2-pipes
Advanced tools
Comparing version 1.1.3 to 1.2.2
{ | ||
"name": "angular2-pipes", | ||
"version": "1.1.3", | ||
"version": "1.2.2", | ||
"author": "Dan Revah", | ||
@@ -5,0 +5,0 @@ "description": "Useful angular2 pipes", |
166
README.md
@@ -47,2 +47,3 @@ # ngx-pipes | ||
- [groupBy](#groupby) | ||
- [filterBy](#filterby) | ||
- [Object](#object) | ||
@@ -59,2 +60,3 @@ - [keys](#keys) | ||
- [max](#max) | ||
- [sum](#sum) | ||
- [percentage](#percentage) | ||
@@ -136,3 +138,3 @@ - [ceil](#ceil) | ||
API: `string | repeat: times: [separator|optional]` | ||
**Usage:** `string | repeat: times: [separator|optional]` | ||
@@ -147,3 +149,3 @@ ```html | ||
API: `string | scan: [ARRAY]` | ||
**Usage:** `string | scan: [ARRAY]` | ||
@@ -158,5 +160,4 @@ ```html | ||
**Usage:** `string | shorten: length: [suffix|optional]: [wordBreak boolean|optional]` | ||
API: `string | shorten: length: [suffix|optional]: [wordBreak boolean|optional]` | ||
```html | ||
@@ -170,3 +171,3 @@ <p>{{'Hey foo bar' | shorten: 3: '...'}}</p> <!-- Output: "Hey..." --> | ||
API: `string | stripTags: [ARRAY]` | ||
**Usage:** `string | stripTags: [ARRAY]` | ||
@@ -198,3 +199,3 @@ ```html | ||
API: `string | trim: [characters|optional]` | ||
**Usage:** `string | trim: [characters|optional]` | ||
@@ -210,3 +211,3 @@ ```html | ||
API: `string | ltrim: [characters|optional]` | ||
**Usage:** `string | ltrim: [characters|optional]` | ||
@@ -222,3 +223,3 @@ ```html | ||
API: `string | rtrim: [characters|optional]` | ||
**Usage:** `string | rtrim: [characters|optional]` | ||
@@ -234,3 +235,3 @@ ```html | ||
API: `string | reverse` | ||
**Usage:** `string | reverse` | ||
@@ -245,3 +246,3 @@ ```html | ||
API: `string | slugify` | ||
**Usage:** `string | slugify` | ||
@@ -257,3 +258,3 @@ ```html | ||
API: `string | camelize` | ||
**Usage:** `string | camelize` | ||
@@ -270,3 +271,3 @@ ```html | ||
API: `string | latinise` | ||
**Usage:** `string | latinise` | ||
@@ -282,3 +283,3 @@ ```html | ||
API: `string | lines` | ||
**Usage:** `string | lines` | ||
@@ -293,3 +294,3 @@ ```html | ||
API: `string | underscore` | ||
**Usage:** `string | underscore` | ||
@@ -305,3 +306,3 @@ ```html | ||
API: `string | test: {RegExp}: {Flags}` | ||
**Usage:** `string | test: {RegExp}: {Flags}` | ||
@@ -318,3 +319,3 @@ ```html | ||
API: `string | match: {RegExp}: {Flags}` | ||
**Usage:** `string | match: {RegExp}: {Flags}` | ||
@@ -332,3 +333,3 @@ ```html | ||
API: `string | lpad: length: [padCharacter:string|optional]` | ||
**Usage:** `string | lpad: length: [padCharacter:string|optional]` | ||
@@ -346,3 +347,3 @@ ```html | ||
API: `string | rpad: length: [padCharacter:string|optional]` | ||
**Usage:** `string | rpad: length: [padCharacter:string|optional]` | ||
@@ -359,3 +360,3 @@ ```html | ||
API: `array | diff: [ARRAY]: [ARRAY]: ... : [ARRAY]` | ||
**Usage:** `array | diff: [ARRAY]: [ARRAY]: ... : [ARRAY]` | ||
@@ -374,3 +375,3 @@ ```typescript | ||
API: `array | flatten: [shallow|optional]` | ||
**Usage:** `array | flatten: [shallow|optional]` | ||
@@ -390,3 +391,3 @@ ```typescript | ||
API: `array | initial: n` | ||
**Usage:** `array | initial: n` | ||
@@ -405,3 +406,3 @@ ```typescript | ||
API: `array | tail: n` | ||
**Usage:** `array | tail: n` | ||
@@ -420,3 +421,3 @@ ```typescript | ||
API: `array | intersection: [ARRAY]: [ARRAY]: ... : [ARRAY]` | ||
**Usage:** `array | intersection: [ARRAY]: [ARRAY]: ... : [ARRAY]` | ||
@@ -435,3 +436,3 @@ ```typescript | ||
API: `array | reverse` | ||
**Usage:** `array | reverse` | ||
@@ -450,3 +451,3 @@ ```typescript | ||
API: `array | truthify` | ||
**Usage:** `array | truthify` | ||
@@ -465,3 +466,3 @@ ```typescript | ||
API: `array | union: [ARRAY]` | ||
**Usage:** `array | union: [ARRAY]` | ||
@@ -480,3 +481,3 @@ ```typescript | ||
API: `array | unique` | ||
**Usage:** `array | unique` | ||
@@ -495,3 +496,3 @@ ```typescript | ||
API: `array | without: [ARRAY]` | ||
**Usage:** `array | without: [ARRAY]` | ||
@@ -510,3 +511,3 @@ ```typescript | ||
API: `array | pluck: propertyName` | ||
**Usage:** `array | pluck: propertyName` | ||
@@ -545,3 +546,3 @@ ```typescript | ||
API: `array | shuffle` | ||
**Usage:** `array | shuffle` | ||
@@ -560,3 +561,3 @@ ```typescript | ||
API: `array | every: predicate` | ||
**Usage:** `array | every: predicate` | ||
@@ -582,3 +583,3 @@ ```typescript | ||
API: `array | some: predicate` | ||
**Usage:** `array | some: predicate` | ||
@@ -604,3 +605,3 @@ ```typescript | ||
API: `array | sample: [amount | default = 1]` | ||
**Usage:** `array | sample: [amount | default = 1]` | ||
@@ -616,3 +617,3 @@ ```html | ||
API: `array | groupBy: [string | Function]` | ||
**Usage:** `array | groupBy: [string | Function]` | ||
@@ -627,2 +628,31 @@ ```typescript | ||
### filterBy | ||
Returns object of grouped by items by discriminator | ||
**Usage:** `array | filterBy: [prop, nested.prop, ...]: search: [strict | optional]` | ||
```typescript | ||
this.users = [ | ||
{id: 1, first_name: 'John', last_name: 'Doe', work: { company: 'Foo Tech' }}, | ||
{id: 2, first_name: 'Jane', last_name: 'West', work: { company: 'AAA Solutions' }}, | ||
{id: 3, first_name: 'Bruce', last_name: 'John', work: { company: 'Bar Tech' }}, | ||
{id: 4, first_name: 'William', last_name: 'Cent', work: { company: 'Foo Tech' }} | ||
]; | ||
``` | ||
```html | ||
// Returns users with `id` of 1 | ||
<p>{{ users | filterBy: ['id']: 1 }}</p> | ||
<!-- Output: "[{id: 1, first_name: 'John', last_name: 'Doe', work: { company: 'Foo Tech', previous_company: '' }}]" --> | ||
// filterBy also support nested properties | ||
<p>{{ users | filterBy: ['work.company']: 'Bar Tech' }}</p> | ||
<!-- Output: "[{ "id": 3, "first_name": "Bruce", "last_name": "John", "work": { "company": "Bar Tech", "previous_company": "" } }]" --> | ||
// Return users whose first name or last name is 'John'. | ||
<p>{{ users | filterBy: ['first_name', 'last_name']: 'John' }}</p> | ||
<!-- Output: "[{id: 1, first_name: 'John', last_name: 'Doe', work: { company: 'Foo Tech', previous_company: '' }}]" --> | ||
``` | ||
## Object | ||
@@ -634,3 +664,3 @@ | ||
API: `object | keys` | ||
**Usage:** `object | keys` | ||
@@ -645,3 +675,3 @@ ```html | ||
API: `object | values` | ||
**Usage:** `object | values` | ||
@@ -656,3 +686,3 @@ ```html | ||
API: `object | pairs` | ||
**Usage:** `object | pairs` | ||
@@ -668,3 +698,3 @@ ```html | ||
API: `object | pick: [key | string]]` | ||
**Usage:** `object | pick: [key | string]]` | ||
@@ -680,3 +710,3 @@ ```html | ||
API: `object | omit: [key | string]]` | ||
**Usage:** `object | omit: [key | string]]` | ||
@@ -692,3 +722,3 @@ ```html | ||
API: `object | invert` | ||
**Usage:** `object | invert` | ||
@@ -703,3 +733,3 @@ ```html | ||
API: `object | invertBy: [Function | optional]` | ||
**Usage:** `object | invertBy: [Function | optional]` | ||
@@ -724,3 +754,3 @@ ```typescript | ||
API: `array | min` | ||
**Usage:** `array | min` | ||
@@ -735,3 +765,3 @@ ```html | ||
API: `array | max` | ||
**Usage:** `array | max` | ||
@@ -746,3 +776,3 @@ ```html | ||
API: `array | sum` | ||
**Usage:** `array | sum` | ||
@@ -757,3 +787,3 @@ ```html | ||
API: `number | percentage: [total | default = 100]: [floor | default = false]` | ||
**Usage:** `number | percentage: [total | default = 100]: [floor | default = false]` | ||
@@ -770,3 +800,3 @@ ```html | ||
API: `number | ceil: [precision | default = 0]` | ||
**Usage:** `number | ceil: [precision | default = 0]` | ||
@@ -782,3 +812,3 @@ ```html | ||
API: `number | floor: [precision | default = 0]` | ||
**Usage:** `number | floor: [precision | default = 0]` | ||
@@ -794,3 +824,3 @@ ```html | ||
API: `number | round: [precision | default = 0]` | ||
**Usage:** `number | round: [precision | default = 0]` | ||
@@ -807,3 +837,3 @@ ```html | ||
API: `number | sqrt` | ||
**Usage:** `number | sqrt` | ||
@@ -818,3 +848,3 @@ ```html | ||
API: `number | pow: [power | default = 2]` | ||
**Usage:** `number | pow: [power | default = 2]` | ||
@@ -830,3 +860,3 @@ ```html | ||
API: `number | degrees` | ||
**Usage:** `number | degrees` | ||
@@ -841,3 +871,3 @@ ```html | ||
API: `number | radians` | ||
**Usage:** `number | radians` | ||
@@ -852,3 +882,3 @@ ```html | ||
API: `number | bytes` | ||
**Usage:** `number | bytes` | ||
@@ -866,3 +896,3 @@ ```html | ||
API: `any | isNull` | ||
**Usage:** `any | isNull` | ||
@@ -876,3 +906,3 @@ ```html | ||
API: `any | isDefined` | ||
**Usage:** `any | isDefined` | ||
@@ -886,3 +916,3 @@ ```html | ||
API: `any | isUndefined` | ||
**Usage:** `any | isUndefined` | ||
@@ -897,3 +927,3 @@ ```html | ||
API: `any | isString` | ||
**Usage:** `any | isString` | ||
@@ -907,3 +937,3 @@ ```html | ||
API: `any | isNumber` | ||
**Usage:** `any | isNumber` | ||
@@ -922,3 +952,3 @@ ```typescript | ||
API: `any | isArray` | ||
**Usage:** `any | isArray` | ||
@@ -937,3 +967,3 @@ ```typescript | ||
API: `any | isObject` | ||
**Usage:** `any | isObject` | ||
@@ -952,3 +982,3 @@ ```typescript | ||
API: `number | isGreaterThan: otherNumber` | ||
**Usage:** `number | isGreaterThan: otherNumber` | ||
@@ -963,3 +993,3 @@ ```html | ||
API: `number | isGreaterEqualThan: otherNumber` | ||
**Usage:** `number | isGreaterEqualThan: otherNumber` | ||
@@ -974,3 +1004,3 @@ ```html | ||
API: `number | isLessThan: otherNumber` | ||
**Usage:** `number | isLessThan: otherNumber` | ||
@@ -985,3 +1015,3 @@ ```html | ||
API: `number | isLessEqualThan: otherNumber` | ||
**Usage:** `number | isLessEqualThan: otherNumber` | ||
@@ -996,3 +1026,3 @@ ```html | ||
API: `number | isEqualTo: otherNumber` | ||
**Usage:** `number | isEqualTo: otherNumber` | ||
@@ -1008,3 +1038,3 @@ ```html | ||
API: `number | isNotEqualTo: otherNumber` | ||
**Usage:** `number | isNotEqualTo: otherNumber` | ||
@@ -1020,3 +1050,3 @@ ```html | ||
API: `number | isIdenticalTo: otherNumber` | ||
**Usage:** `number | isIdenticalTo: otherNumber` | ||
@@ -1032,3 +1062,3 @@ ```html | ||
API: `number | isNotIdenticalTo: otherNumber` | ||
**Usage:** `number | isNotIdenticalTo: otherNumber` | ||
@@ -1035,0 +1065,0 @@ ```html |
@@ -19,1 +19,2 @@ export declare class NgArrayPipesModule { | ||
export * from './group-by'; | ||
export * from './filter-by'; |
@@ -30,2 +30,3 @@ "use strict"; | ||
var group_by_1 = require('./group-by'); | ||
var filter_by_1 = require('./filter-by'); | ||
var core_1 = require('@angular/core'); | ||
@@ -35,3 +36,3 @@ var ARRAY_PIPES = [ | ||
truthify_1.TrurthifyPipe, union_1.UnionPipe, unique_1.UniquePipe, without_1.WithoutPipe, pluck_1.PluckPipe, shuffle_1.ShufflePipe, | ||
every_1.EveryPipe, some_1.SomePipe, sample_1.SamplePipe, group_by_1.GroupByPipe | ||
every_1.EveryPipe, some_1.SomePipe, sample_1.SamplePipe, group_by_1.GroupByPipe, filter_by_1.FilterByPipe | ||
]; | ||
@@ -68,3 +69,4 @@ var NgArrayPipesModule = (function () { | ||
__export(require('./group-by')); | ||
__export(require('./filter-by')); | ||
//# sourceMappingURL=index.js.map |
@@ -1,18 +0,19 @@ | ||
import { DiffPipe } from './diff'; | ||
import { InitialPipe } from './initial'; | ||
import { FlattenPipe } from './flatten'; | ||
import { IntersectionPipe } from './intersection'; | ||
import { ReversePipe } from './reverse'; | ||
import { TailPipe } from './tail'; | ||
import { TrurthifyPipe } from './truthify'; | ||
import { UnionPipe } from './union'; | ||
import { UniquePipe } from './unique'; | ||
import { WithoutPipe } from './without'; | ||
import { PluckPipe } from './pluck'; | ||
import { ShufflePipe } from './shuffle'; | ||
import { EveryPipe } from './every'; | ||
import { SomePipe } from './some'; | ||
import { SamplePipe } from './sample'; | ||
import { GroupByPipe } from './group-by'; | ||
import { NgModule } from '@angular/core'; | ||
import {DiffPipe} from './diff'; | ||
import {InitialPipe} from './initial'; | ||
import {FlattenPipe} from './flatten'; | ||
import {IntersectionPipe} from './intersection'; | ||
import {ReversePipe} from './reverse'; | ||
import {TailPipe} from './tail'; | ||
import {TrurthifyPipe} from './truthify'; | ||
import {UnionPipe} from './union'; | ||
import {UniquePipe} from './unique'; | ||
import {WithoutPipe} from './without'; | ||
import {PluckPipe} from './pluck'; | ||
import {ShufflePipe} from './shuffle'; | ||
import {EveryPipe} from './every'; | ||
import {SomePipe} from './some'; | ||
import {SamplePipe} from './sample'; | ||
import {GroupByPipe} from './group-by'; | ||
import {FilterByPipe} from './filter-by'; | ||
import {NgModule} from '@angular/core'; | ||
@@ -22,3 +23,3 @@ const ARRAY_PIPES = [ | ||
TrurthifyPipe, UnionPipe, UniquePipe, WithoutPipe, PluckPipe, ShufflePipe, | ||
EveryPipe, SomePipe, SamplePipe, GroupByPipe | ||
EveryPipe, SomePipe, SamplePipe, GroupByPipe, FilterByPipe | ||
]; | ||
@@ -31,3 +32,4 @@ | ||
}) | ||
export class NgArrayPipesModule {} | ||
export class NgArrayPipesModule { | ||
} | ||
@@ -50,1 +52,2 @@ export * from './diff'; | ||
export * from './group-by'; | ||
export * from './filter-by'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
385041
408
5658
1031