angular-semver-sort-rails 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/angular-semver-sort-rails.gemspec +1 -1
- data/vendor/assets/javascripts/angular-semver-sort.js +44 -23
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697b3a04876872d8d17ed7bae3a794f7f48489d6
|
4
|
+
data.tar.gz: b5106e298ccdf11e592440450a93733ab4eac8bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e447f82397e24966d84d3b41c14f533750055b127becb0b891ed36ab240596d5997981e0ad8c67dfa7b1770883e85c6120c8447f4d0628f2ef853032c95a124
|
7
|
+
data.tar.gz: e988b028526055983f21e9ee33275436b23a46654122a69f1ade8501f54d5de6da4d77c2105f7f75a59c2e2f58b74cfb3b7bc6370a42289a8e570e23099a33bd
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
# This is the only reason why this asset gem was created.
|
8
8
|
|
9
9
|
spec.name = 'angular-semver-sort-rails'
|
10
|
-
spec.version = '0.2.
|
10
|
+
spec.version = '0.2.2'
|
11
11
|
spec.authors = ['Dominik Porada']
|
12
12
|
spec.email = ['dominik@porada.co']
|
13
13
|
spec.summary = 'angular-semver-sort packaged for Rails assets pipeline'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
angular-semver-sort v0.2.
|
2
|
+
angular-semver-sort v0.2.2 <http://git.io/angular-semver>
|
3
3
|
@includes <http://git.io/semver> by Isaac Z. Schlueter
|
4
4
|
@license BSD
|
5
5
|
*/
|
@@ -1043,8 +1043,35 @@ if (typeof define === 'function' && define.amd)
|
|
1043
1043
|
semver = {}
|
1044
1044
|
);
|
1045
1045
|
|
1046
|
-
;angular.module('semverSort', []).
|
1047
|
-
'
|
1046
|
+
;angular.module('semverSort', []).factory('semverSortArrayHelpers', function() {
|
1047
|
+
'use strict';
|
1048
|
+
|
1049
|
+
var clone = function(collection) {
|
1050
|
+
return (collection || []).slice(0);
|
1051
|
+
};
|
1052
|
+
|
1053
|
+
var sortAlphabetically = function(collection, prop) {
|
1054
|
+
var items = clone(collection);
|
1055
|
+
return !prop ? items.sort() : items.sort(function(A, B) {
|
1056
|
+
var a = A[prop], b = B[prop];
|
1057
|
+
if ( a > b ) return 1;
|
1058
|
+
if ( a < b ) return -1;
|
1059
|
+
return 0;
|
1060
|
+
});
|
1061
|
+
};
|
1062
|
+
|
1063
|
+
var reverse = function(collection) {
|
1064
|
+
return clone(collection).reverse();
|
1065
|
+
};
|
1066
|
+
|
1067
|
+
return {
|
1068
|
+
clone: clone,
|
1069
|
+
sortAlphabetically: sortAlphabetically,
|
1070
|
+
reverse: reverse
|
1071
|
+
};
|
1072
|
+
|
1073
|
+
}).filter('semverSort', [
|
1074
|
+
'$window', '$log', 'semverSortArrayHelpers', function($window, $log, _) {
|
1048
1075
|
'use strict';
|
1049
1076
|
|
1050
1077
|
var semver = $window.semver;
|
@@ -1053,46 +1080,40 @@ if (typeof define === 'function' && define.amd)
|
|
1053
1080
|
var WARNING_UNAVAILABLE = 'Semver library is unvailable. ' + WARNING_FALLBACK;
|
1054
1081
|
var WARNING_NONSEMVER = 'This collection contains non-semver strings. ' + WARNING_FALLBACK;
|
1055
1082
|
|
1056
|
-
var sortAlphabetically = function(collection, prop) {
|
1057
|
-
var items = collection.slice(0);
|
1058
|
-
return !prop ? items.sort() : items.sort(function(A, B) {
|
1059
|
-
var a = A[prop], b = B[prop];
|
1060
|
-
if ( a > b ) return 1;
|
1061
|
-
if ( a < b ) return -1;
|
1062
|
-
return 0;
|
1063
|
-
});
|
1064
|
-
};
|
1065
|
-
|
1066
1083
|
if ( !(semver && 'SEMVER_SPEC_VERSION' in semver) ) {
|
1067
1084
|
$log.warn(WARNING_UNAVAILABLE);
|
1068
|
-
return sortAlphabetically;
|
1085
|
+
return _.sortAlphabetically;
|
1069
1086
|
}
|
1070
1087
|
|
1088
|
+
var isItemValid = function(item) {
|
1089
|
+
return semver.valid(item, true);
|
1090
|
+
};
|
1091
|
+
|
1071
1092
|
var areItemsValid = function(collection, prop) {
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
return items.every(function(item) {
|
1076
|
-
return semver.valid(item, true);
|
1093
|
+
if ( !collection ) return false;
|
1094
|
+
return !prop ? collection.every(isItemValid) : collection.every(function(item) {
|
1095
|
+
return isItemValid(item[prop]);
|
1077
1096
|
});
|
1078
1097
|
};
|
1079
1098
|
|
1080
1099
|
return function(collection, prop) {
|
1081
1100
|
if ( !areItemsValid(collection, prop) ) {
|
1082
1101
|
$log.warn(WARNING_NONSEMVER);
|
1083
|
-
return sortAlphabetically(collection, prop);
|
1102
|
+
return _.sortAlphabetically(collection, prop);
|
1084
1103
|
}
|
1085
1104
|
|
1086
|
-
var items =
|
1105
|
+
var items = _.clone(collection);
|
1087
1106
|
return !prop ? semver.sort(items, true) : items.sort(function(A, B) {
|
1088
1107
|
return semver.compare(A[prop], B[prop], true);
|
1089
1108
|
});
|
1090
1109
|
};
|
1091
1110
|
}
|
1092
1111
|
]).filter('semverReverseSort', [
|
1093
|
-
'$filter', function($filter) {
|
1112
|
+
'$filter', 'semverSortArrayHelpers', function($filter, _) {
|
1113
|
+
'use strict';
|
1114
|
+
|
1094
1115
|
return function(collection, prop) {
|
1095
|
-
return $filter('semverSort')(collection, prop)
|
1116
|
+
return _.reverse($filter('semverSort')(collection, prop));
|
1096
1117
|
};
|
1097
1118
|
}
|
1098
1119
|
]);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angular-semver-sort-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Porada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
73
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.
|
74
|
+
rubygems_version: 2.3.0
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: angular-semver-sort packaged for Rails assets pipeline
|