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; } 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); 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 +}