From a3acd6e12677831cbc8eca8b26e79018674506d3 Mon Sep 17 00:00:00 2001 From: adwaith-implementhit Date: Thu, 8 Oct 2015 16:33:48 +0530 Subject: [PATCH 1/3] Update repeat.js Stronger type checking --- src/_filter/string/repeat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_filter/string/repeat.js b/src/_filter/string/repeat.js index 627d0ec..2b2cb43 100644 --- a/src/_filter/string/repeat.js +++ b/src/_filter/string/repeat.js @@ -30,8 +30,8 @@ angular.module('a8m.repeat', []) * @returns {*} */ function strRepeat(str, n, sep) { - if(!n) { + if(!isNumber(n) || !n) { return str; } return str + sep + strRepeat(str, --n, sep); -} \ No newline at end of file +} From dff830db1d645b85e1ac813955c9dd67ffb88afb Mon Sep 17 00:00:00 2001 From: adwaith-implementhit Date: Thu, 8 Oct 2015 16:36:44 +0530 Subject: [PATCH 2/3] Update group-by.js Stronger type checking. --- src/_filter/collection/group-by.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_filter/collection/group-by.js b/src/_filter/collection/group-by.js index 5832098..aba7003 100644 --- a/src/_filter/collection/group-by.js +++ b/src/_filter/collection/group-by.js @@ -33,7 +33,7 @@ angular.module('a8m.group-by', [ 'a8m.filter-watcher' ]) forEach( collection, function( elm ) { prop = getter(elm); - if(!result[prop]) { + if(!isArray(result[prop])) { result[prop] = []; } result[prop].push(elm); From df8f2de9114b51cd8815d18c277cba16e20f68ae Mon Sep 17 00:00:00 2001 From: adwaith-implementhit Date: Thu, 8 Oct 2015 16:37:48 +0530 Subject: [PATCH 3/3] Update count-by.js Stronger type checking. If the value of prop is something like "valueOf", or "watch", then by the previous logic, the elm wouldn't be grouped at all, since reult[prop] would be a function, and wouldn't have the property "push". --- src/_filter/collection/count-by.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_filter/collection/count-by.js b/src/_filter/collection/count-by.js index 0be73e0..1964424 100644 --- a/src/_filter/collection/count-by.js +++ b/src/_filter/collection/count-by.js @@ -25,7 +25,7 @@ angular.module('a8m.count-by', []) collection.forEach( function( elm ) { prop = get(elm); - if(!result[prop]) { + if(!isArray(result[prop])) { result[prop] = 0; }