Skip to content

Commit aad5f38

Browse files
committed
style(*): spaces, ternary operation
1 parent b161692 commit aad5f38

File tree

8 files changed

+35
-51
lines changed

8 files changed

+35
-51
lines changed

src/_filter/collection/after-where.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
* in the collection after the first that found with the given properties.
99
*
1010
*/
11-
1211
angular.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;

src/_filter/collection/after.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
angular.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
});

src/_filter/collection/before-where.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
* in the collection before the first that found with the given properties.
99
*
1010
*/
11-
1211
angular.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;

src/_filter/collection/before.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@
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-
1210
angular.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
});

src/_filter/collection/concat.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
*/
1010

1111
angular.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
};

src/_filter/collection/every.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,19 @@
77
* Checks if given expression is present in all members in the collection
88
*
99
*/
10-
1110
angular.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
}]);

src/_filter/collection/filter-by.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* filter by specific properties, avoid the rest
88
*/
99
angular.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
}]);

src/_filter/collection/first.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
* if callback is provided, is returns as long the callback return truthy
99
*/
1010
angular.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;

0 commit comments

Comments
 (0)