Skip to content

Commit c693566

Browse files
committed
Update angular-filter.js
1 parent 6a3120f commit c693566

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

dist/angular-filter.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Bunch of useful filters for angularJS(with no external dependencies!)
3-
* @version v0.5.3 - 2015-02-18 * @link https://github.com/a8m/angular-filter
3+
* @version v0.5.3 - 2015-02-19 * @link https://github.com/a8m/angular-filter
44
* @author Ariel Mashraki <ariel@mashraki.co.il>
55
* @license MIT License, http://www.opensource.org/licenses/MIT
66
*/
@@ -1729,6 +1729,27 @@ angular.module('a8m.ltrim', [])
17291729
}
17301730
});
17311731

1732+
/**
1733+
* @ngdoc filter
1734+
* @name match
1735+
* @kind function
1736+
*
1737+
* @description
1738+
* Return the matched pattern in a string.
1739+
*/
1740+
angular.module('a8m.match', [])
1741+
1742+
.filter('match', function () {
1743+
return function (input, pattern, flag) {
1744+
1745+
var reg = new RegExp(pattern, flag);
1746+
1747+
return isString(input)
1748+
? input.match(reg)
1749+
: null;
1750+
}
1751+
});
1752+
17321753
/**
17331754
* @ngdoc filter
17341755
* @name repeat
@@ -2167,6 +2188,7 @@ angular.module('angular.filter', [
21672188
'a8m.rtrim',
21682189
'a8m.repeat',
21692190
'a8m.test',
2191+
'a8m.match',
21702192

21712193
'a8m.to-array',
21722194
'a8m.concat',

0 commit comments

Comments
 (0)