File tree Expand file tree Collapse file tree 8 files changed +35
-51
lines changed Expand file tree Collapse file tree 8 files changed +35
-51
lines changed Original file line number Diff line number Diff line change 88 * in the collection after the first that found with the given properties.
99 *
1010 */
11-
1211angular . module ( 'a8m.after-where' , [ ] )
1312 . filter ( 'afterWhere' , function ( ) {
1413 return function ( collection , object ) {
1514
16- collection = ( isObject ( collection ) ) ?
17- toArray ( collection ) :
18- collection ;
15+ collection = ( isObject ( collection ) )
16+ ? toArray ( collection )
17+ : collection ;
1918
2019 if ( ! isArray ( collection ) || isUndefined ( object ) )
2120 return collection ;
Original file line number Diff line number Diff line change 1212angular . module ( 'a8m.after' , [ ] )
1313 . filter ( 'after' , function ( ) {
1414 return function ( collection , count ) {
15+ collection = ( isObject ( collection ) )
16+ ? toArray ( collection )
17+ : collection ;
1518
16- collection = ( isObject ( collection ) ) ?
17- toArray ( collection ) :
18- collection ;
19-
20- return ( isArray ( collection ) ) ?
21- collection . slice ( count ) :
22- collection ;
23-
19+ return ( isArray ( collection ) )
20+ ? collection . slice ( count )
21+ : collection ;
2422 }
2523 } ) ;
Original file line number Diff line number Diff line change 88 * in the collection before the first that found with the given properties.
99 *
1010 */
11-
1211angular . module ( 'a8m.before-where' , [ ] )
1312 . filter ( 'beforeWhere' , function ( ) {
1413 return function ( collection , object ) {
1514
16- collection = ( isObject ( collection ) ) ?
17- toArray ( collection ) :
18- collection ;
15+ collection = ( isObject ( collection ) )
16+ ? toArray ( collection )
17+ : collection ;
1918
2019 if ( ! isArray ( collection ) || isUndefined ( object ) )
2120 return collection ;
Original file line number Diff line number Diff line change 66 * @description
77 * get a collection and specified count, and returns all of the items
88 * in the collection before the specified count.
9- *
109 */
11-
1210angular . module ( 'a8m.before' , [ ] )
1311 . filter ( 'before' , function ( ) {
1412 return function ( collection , count ) {
13+ collection = ( isObject ( collection ) )
14+ ? toArray ( collection )
15+ : collection ;
1516
16- collection = ( isObject ( collection ) ) ?
17- toArray ( collection ) :
18- collection ;
19-
20- return ( isArray ( collection ) ) ?
21- collection . slice ( 0 , ( ! count ) ? count : -- count ) :
22- collection ;
23-
17+ return ( isArray ( collection ) )
18+ ? collection . slice ( 0 , ( ! count ) ? count : -- count )
19+ : collection ;
2420 }
2521 } ) ;
Original file line number Diff line number Diff line change 99 */
1010
1111angular . module ( 'a8m.concat' , [ ] )
12- //TODO:unique option ? or use unique filter to filter result
12+ //TODO(Ariel) :unique option ? or use unique filter to filter result
1313 . filter ( 'concat' , [ function ( ) {
1414 return function ( collection , joined ) {
1515
1616 if ( isUndefined ( joined ) ) {
1717 return collection ;
1818 }
1919 if ( isArray ( collection ) ) {
20- return ( isObject ( joined ) ) ?
21- collection . concat ( toArray ( joined ) ) :
22- collection . concat ( joined ) ;
20+ return ( isObject ( joined ) )
21+ ? collection . concat ( toArray ( joined ) )
22+ : collection . concat ( joined ) ;
2323 }
2424
2525 if ( isObject ( collection ) ) {
2626 var array = toArray ( collection ) ;
27- return ( isObject ( joined ) ) ?
28- array . concat ( toArray ( joined ) ) :
29- array . concat ( joined ) ;
27+ return ( isObject ( joined ) )
28+ ? array . concat ( toArray ( joined ) )
29+ : array . concat ( joined ) ;
3030 }
3131 return collection ;
3232 } ;
Original file line number Diff line number Diff line change 77 * Checks if given expression is present in all members in the collection
88 *
99 */
10-
1110angular . module ( 'a8m.every' , [ ] )
1211 . filter ( 'every' , [ '$parse' , function ( $parse ) {
1312 return function ( collection , expression ) {
14-
1513 collection = ( isObject ( collection ) ) ? toArray ( collection ) : collection ;
1614
1715 if ( ! isArray ( collection ) || isUndefined ( expression ) ) {
1816 return true ;
1917 }
2018
2119 return collection . every ( function ( elm ) {
22-
23- return ( isObject ( elm ) || isFunction ( expression ) ) ?
24- $parse ( expression ) ( elm ) :
25- elm === expression ;
20+ return ( isObject ( elm ) || isFunction ( expression ) )
21+ ? $parse ( expression ) ( elm )
22+ : elm === expression ;
2623 } ) ;
27-
2824 }
2925 } ] ) ;
Original file line number Diff line number Diff line change 77 * filter by specific properties, avoid the rest
88 */
99angular . module ( 'a8m.filter-by' , [ ] )
10-
1110 . filter ( 'filterBy' , [ '$parse' , function ( $parse ) {
1211 return function ( collection , properties , search ) {
1312
@@ -23,7 +22,6 @@ angular.module('a8m.filter-by', [])
2322 }
2423
2524 return collection . filter ( function ( elm ) {
26-
2725 return properties . some ( function ( prop ) {
2826
2927 /**
@@ -42,12 +40,10 @@ angular.module('a8m.filter-by', [])
4240 } ) ;
4341 }
4442
45- return ( isString ( comparator ) || isNumber ( comparator ) ) ?
46- String ( comparator ) . toLowerCase ( ) . contains ( search ) :
47- false ;
48- } )
49-
43+ return ( isString ( comparator ) || isNumber ( comparator ) )
44+ ? String ( comparator ) . toLowerCase ( ) . contains ( search )
45+ : false ;
46+ } ) ;
5047 } ) ;
51-
5248 }
5349 } ] ) ;
Original file line number Diff line number Diff line change 88 * if callback is provided, is returns as long the callback return truthy
99 */
1010angular . module ( 'a8m.first' , [ ] )
11-
1211 . filter ( 'first' , [ '$parse' , function ( $parse ) {
1312 return function ( collection ) {
1413
1514 var n ,
1615 getter ,
1716 args ;
1817
19- collection = ( isObject ( collection ) ) ? toArray ( collection ) :
20- collection ;
18+ collection = ( isObject ( collection ) )
19+ ? toArray ( collection )
20+ : collection ;
2121
2222 if ( ! isArray ( collection ) ) {
2323 return collection ;
You can’t perform that action at this time.
0 commit comments