<commit_before>#Angular-filter &nbsp; [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![License][license-image]][license-url]
>Bunch of useful filters for AngularJS (with no external dependencies!), **v0.5.7**

**Notice:** if you want to use `angular-filter` out of AngularJS(e.g: Node, etc..), check [Agile.js repo](https://github.com/a8m/agile)

##Table of contents:
- [![Gitter][gitter-image]][gitter-url]
- [Get Started](#get-started)
- [Common Questions](https://github.com/a8m/angular-filter/wiki/Common-Questions)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [TODO](#todo)
- [Collection](#collection)
  - [after](#after)
  - [afterWhere](#afterwhere)
  - [before](#before)
  - [beforeWhere](#beforewhere)
  - [concat](#concat)
  - [contains](#contains)
  - [countBy](#countby)
  - [chunkBy](#chunkby)
  - [defaults](#defaults)
  - [every](#every)
  - [filterBy](#filterby)
  - [first](#first)
  - [flatten](#flatten)
  - [fuzzy](#fuzzy)
  - [fuzzyBy](#fuzzyby)
  - [groupBy](#groupby)
  - [isEmpty](#isempty)
  - [join](#join)
  - [last](#last)
  - [map](#map)
  - [omit](#omit)
  - [pick](#pick)
  - [pluck](#pluck)
  - [range](#range)
  - [reverse](#reverse)
  - [remove](#remove)
  - [removeWith](#removewith)
  - [searchField](#searchfield)
  - [some](#contains)
  - [toArray](#toarray)
  - [unique](#unique)
  - [where](#where)
  - [xor](#xor)
- [String](#string)
  - [endsWith](#endswith)
  - [repeat](#repeat)
  - [reverse](#reverse-1)
  - [slugify](#slugify)
  - [latinize](#latinize)
  - [startsWith](#startswith)
  - [stripTags](#striptags)
  - [stringular](#stringular)
  - [test](#test)
  - [match](#match)
  - [trim](#trim)
  - [ltrim](#ltrim)
  - [rtrim](#rtrim)
  - [truncate](#truncate)
  - [ucfirst](#ucfirst)
  - [uriEncode](#uriencode)
  - [uriComponentEncode](#uricomponentencode)
  - [wrap](#wrap)
- [Math](#math)
  - [min](#min)
  - [max](#max)
  - [percent](#percent)
  - [radix](#radix)
  - [sum](#sum)
  - [degrees](#degrees)
  - [radians](#radians)
  - [shortFmt](#shortfmt)
  - [byteFmt](#bytefmt)
  - [kbFmt](#kbfmt)
- [Boolean](#boolean)
  - [isNull](#isnull)
  - [isDefined](#isdefined)
  - [isUndefined](#isundefined)
  - [isString](#isstring)
  - [isNumber](#isnumber)
  - [isObject](#isobject)
  - [isArray](#isarray)
  - [isFunction](#isfunction)
  - [isEqual](#isequal)
  - [isGreaterThan](#isgreaterthan) `>`
  - [isGreaterThanOrEqualTo](#isgreaterthanorequalto) `>=`
  - [isLessThan](#islessthan) `<`
  - [isLessThanOrEqualTo](#islessthanorequalto) `<=`
  - [isEqualTo](#isequalto) `==`
  - [isNotEqualTo](#isnotequalto) `!=`
  - [isIdenticalTo](#isidenticalto) `===`
  - [isNotIdenticalTo](#isnotidenticalto) `!==`

#Get Started
**(1)** You can install angular-filter using 4 different methods:
  - clone & [build](#Contributing) this repository
  - via **[Bower](http://bower.io/)**: by running `$ bower install angular-filter` from your terminal
  - via **[npm](https://www.npmjs.org/)**: by running `$ npm install angular-filter` from your terminal
  - via cdnjs http://www.cdnjs.com/libraries/angular-filter

**(2)** Include `angular-filter.js` (or `angular-filter.min.js`) in your `index.html`, after including Angular itself.

**(3)** Add `'angular.filter'` to your main module's list of dependencies.

When you're done, your setup should look similar to the following:

```html
<!doctype html>
<html ng-app="myApp">
<head>

</head>
<body>
    ...
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular.min.js"></script>
    <script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
    ...
    <script>
        var myApp = angular.module('myApp', ['angular.filter']);

    </script>
    ...
</body>
</html>
```

#Collection

###concat

Concatenates an array/object into another one.


```js
function MainController ($scope) {
  $scope.array = [ {a: 1}, {a: 2} ];
  $scope.object = {
    0: {a: 3},
    1: {a: 4}
  };
}
```

```html
<li ng-repeat="elm in array | concat:object">
  {{ elm.a }}
</li>

<!--
result:
1 2 3 4
-->

<li ng-repeat="elm in object | concat:array">
  {{ elm.a }}
</li>

<!--
result:
3 4 1 2
-->
```

###unique
Remove duplicates from an array/object.<br/>
If a string is provided, it will filter out duplicates using the provided expression.<br/>
**Usage:** ```collection | unique: 'property' ```<br/>
**aliases:** uniq
```js
function MainController ($scope) {
  $scope.orders = [
    { id:1, customer: { name: 'John', id: 10 } },
    { id:2, customer: { name: 'William', id: 20 } },
    { id:3, customer: { name: 'John', id: 10 } },
    { id:4, customer: { name: 'William', id: 20 } },
    { id:5, customer: { name: 'Clive', id: 30 } }
  ];
}
```
Ex: Filter by customer.id
```html
<th>Customer list:</th>
<tr ng-repeat="order in orders | unique: 'customer.id'" >
   <td> {{ order.customer.name }} , {{ order.customer.id }} </td>
</tr>

<!-- result:
All customers list:
John 10
William 20
Clive 30

```
###filterBy
Filter a collection by a specific property.<br/>
**Usage:** ```collection | filterBy: [prop, nested.prop, etc..]: search```<br/>
**Note:** You can even use compound properties (e.g: ```|filterBy: [property + property]: model```)<br/>

```js
$scope.users = [
  { id: 1, user: { first_name: 'Rob', last_name: 'John',  mobile: 4444 } },
  { id: 2, user: { first_name: 'John', last_name: 'Wayne',  mobile: 3333 } },
  { id: 3, user: { first_name: 'Rob', last_name: 'Johansson',  mobile: 2222 } },
  { id: 4, user: { first_name: 'Mike', last_name: 'Terry',  mobile: 1111 } }
];
```<commit_msg>docs(README): add 'strict' filterBy functionality<commit_after>#Angular-filter &nbsp; [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![License][license-image]][license-url]
>Bunch of useful filters for AngularJS (with no external dependencies!), **v0.5.7**

**Notice:** if you want to use `angular-filter` out of AngularJS(e.g: Node, etc..), check [Agile.js repo](https://github.com/a8m/agile)

##Table of contents:
- [![Gitter][gitter-image]][gitter-url]
- [Get Started](#get-started)
- [Common Questions](https://github.com/a8m/angular-filter/wiki/Common-Questions)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [TODO](#todo)
- [Collection](#collection)
  - [after](#after)
  - [afterWhere](#afterwhere)
  - [before](#before)
  - [beforeWhere](#beforewhere)
  - [concat](#concat)
  - [contains](#contains)
  - [countBy](#countby)
  - [chunkBy](#chunkby)
  - [defaults](#defaults)
  - [every](#every)
  - [filterBy](#filterby)
  - [first](#first)
  - [flatten](#flatten)
  - [fuzzy](#fuzzy)
  - [fuzzyBy](#fuzzyby)
  - [groupBy](#groupby)
  - [isEmpty](#isempty)
  - [join](#join)
  - [last](#last)
  - [map](#map)
  - [omit](#omit)
  - [pick](#pick)
  - [pluck](#pluck)
  - [range](#range)
  - [reverse](#reverse)
  - [remove](#remove)
  - [removeWith](#removewith)
  - [searchField](#searchfield)
  - [some](#contains)
  - [toArray](#toarray)
  - [unique](#unique)
  - [where](#where)
  - [xor](#xor)
- [String](#string)
  - [endsWith](#endswith)
  - [repeat](#repeat)
  - [reverse](#reverse-1)
  - [slugify](#slugify)
  - [latinize](#latinize)
  - [startsWith](#startswith)
  - [stripTags](#striptags)
  - [stringular](#stringular)
  - [test](#test)
  - [match](#match)
  - [trim](#trim)
  - [ltrim](#ltrim)
  - [rtrim](#rtrim)
  - [truncate](#truncate)
  - [ucfirst](#ucfirst)
  - [uriEncode](#uriencode)
  - [uriComponentEncode](#uricomponentencode)
  - [wrap](#wrap)
- [Math](#math)
  - [min](#min)
  - [max](#max)
  - [percent](#percent)
  - [radix](#radix)
  - [sum](#sum)
  - [degrees](#degrees)
  - [radians](#radians)
  - [shortFmt](#shortfmt)
  - [byteFmt](#bytefmt)
  - [kbFmt](#kbfmt)
- [Boolean](#boolean)
  - [isNull](#isnull)
  - [isDefined](#isdefined)
  - [isUndefined](#isundefined)
  - [isString](#isstring)
  - [isNumber](#isnumber)
  - [isObject](#isobject)
  - [isArray](#isarray)
  - [isFunction](#isfunction)
  - [isEqual](#isequal)
  - [isGreaterThan](#isgreaterthan) `>`
  - [isGreaterThanOrEqualTo](#isgreaterthanorequalto) `>=`
  - [isLessThan](#islessthan) `<`
  - [isLessThanOrEqualTo](#islessthanorequalto) `<=`
  - [isEqualTo](#isequalto) `==`
  - [isNotEqualTo](#isnotequalto) `!=`
  - [isIdenticalTo](#isidenticalto) `===`
  - [isNotIdenticalTo](#isnotidenticalto) `!==`

#Get Started
**(1)** You can install angular-filter using 4 different methods:
  - clone & [build](#Contributing) this repository
  - via **[Bower](http://bower.io/)**: by running `$ bower install angular-filter` from your terminal
  - via **[npm](https://www.npmjs.org/)**: by running `$ npm install angular-filter` from your terminal
  - via cdnjs http://www.cdnjs.com/libraries/angular-filter

**(2)** Include `angular-filter.js` (or `angular-filter.min.js`) in your `index.html`, after including Angular itself.

**(3)** Add `'angular.filter'` to your main module's list of dependencies.

When you're done, your setup should look similar to the following:

```html
<!doctype html>
<html ng-app="myApp">
<head>

</head>
<body>
    ...
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular.min.js"></script>
    <script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
    ...
    <script>
        var myApp = angular.module('myApp', ['angular.filter']);

    </script>
    ...
</body>
</html>
```

#Collection

###concat

Concatenates an array/object into another one.


```js
function MainController ($scope) {
  $scope.array = [ {a: 1}, {a: 2} ];
  $scope.object = {
    0: {a: 3},
    1: {a: 4}
  };
}
```

```html
<li ng-repeat="elm in array | concat:object">
  {{ elm.a }}
</li>

<!--
result:
1 2 3 4
-->

<li ng-repeat="elm in object | concat:array">
  {{ elm.a }}
</li>

<!--
result:
3 4 1 2
-->
```

###unique
Remove duplicates from an array/object.<br/>
If a string is provided, it will filter out duplicates using the provided expression.<br/>
**Usage:** ```collection | unique: 'property' ```<br/>
**aliases:** uniq
```js
function MainController ($scope) {
  $scope.orders = [
    { id:1, customer: { name: 'John', id: 10 } },
    { id:2, customer: { name: 'William', id: 20 } },
    { id:3, customer: { name: 'John', id: 10 } },
    { id:4, customer: { name: 'William', id: 20 } },
    { id:5, customer: { name: 'Clive', id: 30 } }
  ];
}
```
Ex: Filter by customer.id
```html
<th>Customer list:</th>
<tr ng-repeat="order in orders | unique: 'customer.id'" >
   <td> {{ order.customer.name }} , {{ order.customer.id }} </td>
</tr>

<!-- result:
All customers list:
John 10
William 20
Clive 30

```
###filterBy
Filter a collection by a specific property.<br/>
**Usage:** ```collection | filterBy: [prop, nested.prop, etc..]: search: strict[optional]```<br/>
**Note:** You can even use compound properties (e.g: ```|filterBy: [property + property]: model```)<br/>

```js
$scope.users = [
  { id: 1, user: { first_name: 'Rob', last_name: 'John',  mobile: 4444 } },
  { id: 2, user: { first_name: 'John', last_name: 'Wayne',  mobile: 3333 } },
  { id: 3, user: { first_name: 'Rob', last_name: 'Johansson',  mobile: 2222 } },
  { id: 4, user: { first_name: 'Mike', last_name: 'Terry',  mobile: 1111 } }
];
```
{'fraction_non_alphanumeric': 0.2246813031161473, 'fraction_numerical': 0.012039660056657223, 'mean_word_length': 4.00310008857396, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5021164', 'n_tokens_mistral': 4539, 'n_tokens_neox': 4178, 'n_words': 851}