sugar-rails 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sugar/rails/version.rb +2 -2
- data/vendor/assets/javascripts/precompiled/development/array.js +19 -16
- data/vendor/assets/javascripts/precompiled/development/core.js +7 -1
- data/vendor/assets/javascripts/precompiled/development/date.js +44 -15
- data/vendor/assets/javascripts/precompiled/development/es5.js +0 -6
- data/vendor/assets/javascripts/precompiled/development/number.js +20 -14
- data/vendor/assets/javascripts/precompiled/development/object.js +4 -3
- data/vendor/assets/javascripts/precompiled/development/string.js +22 -11
- data/vendor/assets/javascripts/precompiled/minified/array.js +15 -14
- data/vendor/assets/javascripts/precompiled/minified/core.js +9 -9
- data/vendor/assets/javascripts/precompiled/minified/date.js +34 -33
- data/vendor/assets/javascripts/precompiled/minified/date_locales.js +1 -1
- data/vendor/assets/javascripts/precompiled/minified/date_ranges.js +2 -2
- data/vendor/assets/javascripts/precompiled/minified/es5.js +6 -6
- data/vendor/assets/javascripts/precompiled/minified/function.js +3 -3
- data/vendor/assets/javascripts/precompiled/minified/inflections.js +7 -7
- data/vendor/assets/javascripts/precompiled/minified/language.js +9 -9
- data/vendor/assets/javascripts/precompiled/minified/number.js +5 -5
- data/vendor/assets/javascripts/precompiled/minified/object.js +6 -6
- data/vendor/assets/javascripts/precompiled/minified/regexp.js +1 -1
- data/vendor/assets/javascripts/precompiled/minified/string.js +12 -12
- data/vendor/assets/javascripts/sugar-development.js +117 -67
- data/vendor/assets/javascripts/sugar-full.js +111 -109
- data/vendor/assets/javascripts/sugar.js +94 -92
- metadata +4 -4
data/lib/sugar/rails/version.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
} else if(isRegExp(match) && isString(el)) {
|
17
17
|
// Match against a regexp
|
18
18
|
return regexp(match).test(el);
|
19
|
-
} else if(isFunction(match)
|
19
|
+
} else if(isFunction(match)) {
|
20
20
|
// Match against a filtering function
|
21
21
|
return match.apply(scope, params);
|
22
22
|
} else if(isObject(match) && isObjectPrimitive(el)) {
|
@@ -317,10 +317,12 @@
|
|
317
317
|
var result = [], tmp;
|
318
318
|
multiArgs(arguments, function(a) {
|
319
319
|
if(isObjectPrimitive(a)) {
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
320
|
+
try {
|
321
|
+
tmp = array.prototype.slice.call(a, 0);
|
322
|
+
if(tmp.length > 0) {
|
323
|
+
a = tmp;
|
324
|
+
}
|
325
|
+
} catch(e) {}
|
324
326
|
}
|
325
327
|
result = result.concat(a);
|
326
328
|
});
|
@@ -905,15 +907,8 @@
|
|
905
907
|
*
|
906
908
|
***/
|
907
909
|
'sample': function(num) {
|
908
|
-
var
|
909
|
-
|
910
|
-
while(result.length < num) {
|
911
|
-
index = floor(math.random() * (arr.length - 1));
|
912
|
-
result.push(arr[index]);
|
913
|
-
arr.removeAt(index);
|
914
|
-
if(arr.length == 0) break;
|
915
|
-
}
|
916
|
-
return arguments.length > 0 ? result : result[0];
|
910
|
+
var arr = this.randomize();
|
911
|
+
return arguments.length > 0 ? arr.slice(0, num) : arr[0];
|
917
912
|
},
|
918
913
|
|
919
914
|
/***
|
@@ -1102,6 +1097,7 @@
|
|
1102
1097
|
* @extra In cases where a callback is used, instead of %element, index%, the callback will instead be passed %key, value%. Enumerable methods are also available to extended objects as instance methods.
|
1103
1098
|
*
|
1104
1099
|
* @set
|
1100
|
+
* each
|
1105
1101
|
* map
|
1106
1102
|
* any
|
1107
1103
|
* all
|
@@ -1131,7 +1127,8 @@
|
|
1131
1127
|
extendSimilar(object, false, false, names, function(methods, name) {
|
1132
1128
|
methods[name] = function(obj, arg1, arg2) {
|
1133
1129
|
var result;
|
1134
|
-
|
1130
|
+
var x = keysWithCoercion(obj);
|
1131
|
+
result = array.prototype[name].call(x, function(key) {
|
1135
1132
|
if(mapping) {
|
1136
1133
|
return transformArgument(obj[key], arg1, obj, [key, obj[key], obj]);
|
1137
1134
|
} else {
|
@@ -1168,6 +1165,12 @@
|
|
1168
1165
|
return values.reduce.apply(values, multiArgs(arguments).slice(1));
|
1169
1166
|
},
|
1170
1167
|
|
1168
|
+
'each': function(obj, fn) {
|
1169
|
+
checkCallback(fn);
|
1170
|
+
iterateOverObject(obj, fn);
|
1171
|
+
return obj;
|
1172
|
+
},
|
1173
|
+
|
1171
1174
|
/***
|
1172
1175
|
* @method size(<obj>)
|
1173
1176
|
* @returns Number
|
@@ -1186,7 +1189,7 @@
|
|
1186
1189
|
|
1187
1190
|
buildEnhancements();
|
1188
1191
|
buildAlphanumericSort();
|
1189
|
-
buildEnumerableMethods('
|
1192
|
+
buildEnumerableMethods('any,all,none,count,find,findAll,isEmpty');
|
1190
1193
|
buildEnumerableMethods('sum,average,min,max,least,most', true);
|
1191
1194
|
buildObjectInstanceMethods('map,reduce,size', Hash);
|
1192
1195
|
|
@@ -120,6 +120,12 @@
|
|
120
120
|
return result;
|
121
121
|
}
|
122
122
|
|
123
|
+
function checkCallback(fn) {
|
124
|
+
if(!fn || !fn.call) {
|
125
|
+
throw new TypeError('Callback is not callable');
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
123
129
|
|
124
130
|
// General helpers
|
125
131
|
|
@@ -154,7 +160,7 @@
|
|
154
160
|
var key;
|
155
161
|
for(key in obj) {
|
156
162
|
if(!hasOwnProperty(obj, key)) continue;
|
157
|
-
if(fn.call(obj, key, obj[key]) === false) break;
|
163
|
+
if(fn.call(obj, key, obj[key], obj) === false) break;
|
158
164
|
}
|
159
165
|
}
|
160
166
|
|
@@ -10,8 +10,10 @@
|
|
10
10
|
var CurrentLocalization;
|
11
11
|
|
12
12
|
var TimeFormat = ['ampm','hour','minute','second','ampm','utc','offset_sign','offset_hours','offset_minutes','ampm']
|
13
|
-
var
|
14
|
-
var
|
13
|
+
var DecimalReg = '(?:[,.]\\d+)?';
|
14
|
+
var HoursReg = '\\d{1,2}' + DecimalReg;
|
15
|
+
var SixtyReg = '[0-5]\\d' + DecimalReg;
|
16
|
+
var RequiredTime = '({t})?\\s*('+HoursReg+')(?:{h}('+SixtyReg+')?{m}(?::?('+SixtyReg+'){s})?\\s*(?:({t})|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*({t}))';
|
15
17
|
|
16
18
|
var KanjiDigits = '〇一二三四五六七八九十百千万';
|
17
19
|
var FullWidthDigits = '0123456789';
|
@@ -411,6 +413,10 @@
|
|
411
413
|
return arrayToAlternates(arr);
|
412
414
|
}
|
413
415
|
|
416
|
+
function setDefault(name, value) {
|
417
|
+
loc[name] = loc[name] || value;
|
418
|
+
}
|
419
|
+
|
414
420
|
function setModifiers() {
|
415
421
|
var arr = [];
|
416
422
|
loc.modifiersByName = {};
|
@@ -439,10 +445,10 @@
|
|
439
445
|
setArray('units', false, 8);
|
440
446
|
setArray('numbers', false, 10);
|
441
447
|
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
448
|
+
setDefault('code', localeCode);
|
449
|
+
setDefault('date', getDigit(1,2, loc['digitDate']));
|
450
|
+
setDefault('year', "'\\d{2}|" + getDigit(4,4));
|
451
|
+
setDefault('num', getNum());
|
446
452
|
|
447
453
|
setModifiers();
|
448
454
|
|
@@ -537,8 +543,10 @@
|
|
537
543
|
arr.forEach(function(key, i) {
|
538
544
|
value = match[i + 1];
|
539
545
|
if(isUndefined(value) || value === '') return;
|
540
|
-
if(key === 'year')
|
541
|
-
|
546
|
+
if(key === 'year') {
|
547
|
+
obj.yearAsString = value.replace(/'/, '');
|
548
|
+
}
|
549
|
+
num = parseFloat(value.replace(/'/, '').replace(/,/, '.'));
|
542
550
|
obj[key] = !isNaN(num) ? num : value.toLowerCase();
|
543
551
|
});
|
544
552
|
return obj;
|
@@ -855,7 +863,8 @@
|
|
855
863
|
// Date comparison helpers
|
856
864
|
|
857
865
|
function compareDate(d, find, buffer, forceUTC) {
|
858
|
-
var p
|
866
|
+
var p, t, min, max, minOffset, maxOffset, override, capitalized, accuracy = 0, loBuffer = 0, hiBuffer = 0;
|
867
|
+
p = getExtendedDate(find, null, null, forceUTC);
|
859
868
|
if(buffer > 0) {
|
860
869
|
loBuffer = hiBuffer = buffer;
|
861
870
|
override = true;
|
@@ -881,12 +890,27 @@
|
|
881
890
|
hiBuffer = -50;
|
882
891
|
}
|
883
892
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
893
|
+
t = d.getTime();
|
894
|
+
min = p.date.getTime();
|
895
|
+
max = max || (min + accuracy);
|
896
|
+
max = compensateForTimezoneTraversal(d, min, max);
|
887
897
|
return t >= (min - loBuffer) && t <= (max + hiBuffer);
|
888
898
|
}
|
889
899
|
|
900
|
+
function compensateForTimezoneTraversal(d, min, max) {
|
901
|
+
var dMin, dMax, minOffset, maxOffset;
|
902
|
+
dMin = new Date(min);
|
903
|
+
dMax = new Date(max).utc(d.isUTC());
|
904
|
+
if(callDateGet(dMax, 'Hours') !== 23) {
|
905
|
+
minOffset = dMin.getTimezoneOffset();
|
906
|
+
maxOffset = dMax.getTimezoneOffset();
|
907
|
+
if(minOffset !== maxOffset) {
|
908
|
+
max += (maxOffset - minOffset).minutes();
|
909
|
+
}
|
910
|
+
}
|
911
|
+
return max;
|
912
|
+
}
|
913
|
+
|
890
914
|
function updateDate(d, params, reset, advance, prefer) {
|
891
915
|
var weekday, specificityIndex;
|
892
916
|
|
@@ -917,7 +941,9 @@
|
|
917
941
|
}
|
918
942
|
|
919
943
|
// "date" can also be passed for the day
|
920
|
-
if(params['date'])
|
944
|
+
if(isDefined(params['date'])) {
|
945
|
+
params['day'] = params['date'];
|
946
|
+
}
|
921
947
|
|
922
948
|
// Reset any unit lower than the least specific unit set. Do not do this for weeks
|
923
949
|
// or for years. This needs to be performed before the acutal setting of the date
|
@@ -1030,7 +1056,9 @@
|
|
1030
1056
|
// (or 29th in the case of a leap year).
|
1031
1057
|
|
1032
1058
|
function checkMonthTraversal(date, targetMonth) {
|
1033
|
-
if(targetMonth < 0)
|
1059
|
+
if(targetMonth < 0) {
|
1060
|
+
targetMonth = targetMonth % 12 + 12;
|
1061
|
+
}
|
1034
1062
|
if(targetMonth % 12 != callDateGet(date, 'Month')) {
|
1035
1063
|
callDateSet(date, 'Date', 0);
|
1036
1064
|
}
|
@@ -2152,7 +2180,7 @@
|
|
2152
2180
|
'units': 'millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s',
|
2153
2181
|
'numbers': 'one,two,three,four,five,six,seven,eight,nine,ten',
|
2154
2182
|
'articles': 'a,an,the',
|
2155
|
-
'tokens':
|
2183
|
+
'tokens': 'the,st|nd|rd|th,of',
|
2156
2184
|
'short': '{Month} {d}, {yyyy}',
|
2157
2185
|
'long': '{Month} {d}, {yyyy} {h}:{mm}{tt}',
|
2158
2186
|
'full': '{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}',
|
@@ -2184,6 +2212,7 @@
|
|
2184
2212
|
'{0} {num}{1} {day} of {month} {year?}',
|
2185
2213
|
'{weekday?} {month} {date}{1?} {year?}',
|
2186
2214
|
'{date} {month} {year}',
|
2215
|
+
'{date} {month}',
|
2187
2216
|
'{shift} {weekday}',
|
2188
2217
|
'{shift} week {weekday}',
|
2189
2218
|
'{weekday} {2?} {shift} week',
|
@@ -84,12 +84,6 @@
|
|
84
84
|
}
|
85
85
|
}
|
86
86
|
|
87
|
-
function checkCallback(fn) {
|
88
|
-
if(!fn || !fn.call) {
|
89
|
-
throw new TypeError('Callback is not callable');
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
87
|
function checkFirstArgumentExists(args) {
|
94
88
|
if(args.length === 0) {
|
95
89
|
throw new TypeError('First argument must be defined');
|
@@ -146,7 +146,7 @@
|
|
146
146
|
*
|
147
147
|
***/
|
148
148
|
'isOdd': function() {
|
149
|
-
return !this.isMultipleOf(2);
|
149
|
+
return !isNaN(this) && !this.isMultipleOf(2);
|
150
150
|
},
|
151
151
|
|
152
152
|
/***
|
@@ -194,21 +194,27 @@
|
|
194
194
|
*
|
195
195
|
***/
|
196
196
|
'format': function(place, thousands, decimal) {
|
197
|
-
var str, split,
|
198
|
-
if(
|
199
|
-
|
200
|
-
thousands = thousands || ',';
|
201
|
-
decimal = decimal || '.';
|
202
|
-
split = str.split('.');
|
203
|
-
str = split[0];
|
204
|
-
after = split[1] || '';
|
205
|
-
while (str.match(r)) {
|
206
|
-
str = str.replace(r, '$1' + thousands + '$2');
|
197
|
+
var i, str, split, integer, fraction, result = '';
|
198
|
+
if(isUndefined(thousands)) {
|
199
|
+
thousands = ',';
|
207
200
|
}
|
208
|
-
if(
|
209
|
-
|
201
|
+
if(isUndefined(decimal)) {
|
202
|
+
decimal = '.';
|
210
203
|
}
|
211
|
-
|
204
|
+
str = (isNumber(place) ? round(this, place || 0).toFixed(math.max(place, 0)) : this.toString()).replace(/^-/, '');
|
205
|
+
split = str.split('.');
|
206
|
+
integer = split[0];
|
207
|
+
fraction = split[1];
|
208
|
+
for(i = integer.length; i > 0; i -= 3) {
|
209
|
+
if(i < integer.length) {
|
210
|
+
result = thousands + result;
|
211
|
+
}
|
212
|
+
result = integer.slice(math.max(0, i - 3), i) + result;
|
213
|
+
}
|
214
|
+
if(fraction) {
|
215
|
+
result += decimal + repeatString((place || 0) - fraction.length, '0') + fraction;
|
216
|
+
}
|
217
|
+
return (this < 0 ? '-' : '') + result;
|
212
218
|
},
|
213
219
|
|
214
220
|
/***
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
/***
|
3
2
|
* @package Object
|
4
3
|
* @dependency core
|
@@ -28,7 +27,7 @@
|
|
28
27
|
});
|
29
28
|
if(!key && paramIsArray) key = obj.length.toString();
|
30
29
|
setParamsObject(obj, key, value);
|
31
|
-
} else if(value.match(/^[
|
30
|
+
} else if(value.match(/^[+-]?\d+(\.\d+)?$/)) {
|
32
31
|
obj[param] = parseFloat(value);
|
33
32
|
} else if(value === 'true') {
|
34
33
|
obj[param] = true;
|
@@ -308,7 +307,9 @@
|
|
308
307
|
* @example
|
309
308
|
*
|
310
309
|
* Object.extend();
|
311
|
-
* [2,4,6].map(Math.exp).tap(function(
|
310
|
+
* [2,4,6].map(Math.exp).tap(function(arr) {
|
311
|
+
* arr.pop()
|
312
|
+
* });
|
312
313
|
* [2,4,6].map(Math.exp).tap('pop').map(Math.round); -> [7,55]
|
313
314
|
*
|
314
315
|
***/
|
@@ -92,8 +92,6 @@
|
|
92
92
|
}
|
93
93
|
}
|
94
94
|
|
95
|
-
|
96
|
-
|
97
95
|
extend(string, true, false, {
|
98
96
|
|
99
97
|
/***
|
@@ -152,7 +150,12 @@
|
|
152
150
|
*
|
153
151
|
***/
|
154
152
|
'escapeHTML': function() {
|
155
|
-
return this.replace(/&/g,
|
153
|
+
return this.replace(/&/g, '&' )
|
154
|
+
.replace(/</g, '<' )
|
155
|
+
.replace(/>/g, '>' )
|
156
|
+
.replace(/"/g, '"')
|
157
|
+
.replace(/'/g, ''')
|
158
|
+
.replace(/\//g, '/');
|
156
159
|
},
|
157
160
|
|
158
161
|
/***
|
@@ -166,7 +169,12 @@
|
|
166
169
|
*
|
167
170
|
***/
|
168
171
|
'unescapeHTML': function() {
|
169
|
-
return this.replace(/&
|
172
|
+
return this.replace(/&/g, '&')
|
173
|
+
.replace(/</g, '<')
|
174
|
+
.replace(/>/g, '>')
|
175
|
+
.replace(/"/g, '"')
|
176
|
+
.replace(/'/g, "'")
|
177
|
+
.replace(///g, '/');
|
170
178
|
},
|
171
179
|
|
172
180
|
/***
|
@@ -753,17 +761,21 @@
|
|
753
761
|
*
|
754
762
|
* 'jumpy'.repeat(2) -> 'jumpyjumpy'
|
755
763
|
* 'a'.repeat(5) -> 'aaaaa'
|
764
|
+
* 'a'.repeat(0) -> ''
|
756
765
|
*
|
757
766
|
***/
|
758
767
|
'repeat': function(num) {
|
759
|
-
var
|
760
|
-
if(isNumber(num)
|
761
|
-
|
762
|
-
|
763
|
-
|
768
|
+
var result = '', str = this;
|
769
|
+
if(!isNumber(num) || num < 1) return '';
|
770
|
+
while (num) {
|
771
|
+
if (num & 1) {
|
772
|
+
result += str;
|
773
|
+
}
|
774
|
+
if (num >>= 1) {
|
775
|
+
str += str;
|
764
776
|
}
|
765
777
|
}
|
766
|
-
return
|
778
|
+
return result;
|
767
779
|
},
|
768
780
|
|
769
781
|
/***
|
@@ -851,7 +863,6 @@
|
|
851
863
|
});
|
852
864
|
return context;
|
853
865
|
}
|
854
|
-
|
855
866
|
});
|
856
867
|
|
857
868
|
|
@@ -1,16 +1,17 @@
|
|
1
|
-
function Ba(a,b,c,d){var e=k;if(a===b)return k;else if(D(b)&&C(a))return r(b).test(a);else if(
|
2
|
-
function T(a,b,c,d){var e,
|
3
|
-
function Fa(a,b){var c=[],d={},e;T(a,function(
|
4
|
-
function Ka(a){var b=[];F(a,function(c){b=b.concat(c)});return b}function Ia(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Ga(a,b){var c=
|
5
|
-
function Ma(a){if(q[Na])a=a.toLowerCase();return a.replace(q[Oa],"")}function Pa(a,b){var c=a.charAt(b);return(q[Qa]||{})[c]||c}function Ra(a){var b=q[Sa];return a?b.indexOf(a):l}var Sa="AlphanumericSortOrder",Oa="AlphanumericSortIgnore",Na="AlphanumericSortIgnoreCase",Qa="AlphanumericSortEquivalents";E(q,n,n,{create:function(){var a=[],b;F(arguments,function(c){if(ka(c)){b=q.prototype.slice.call(c);if(b.length>0)c=b}a=a.concat(c)});return a}});
|
6
|
-
E(q,k,n,{find:function(a,b,c){return Ea(this,a,b,c)},findAll:function(a,b,c){var d=[];T(this,function(e,
|
7
|
-
arguments)},clone:function(){return ma([],this)},unique:function(a){return Fa(this,a)},flatten:function(a){return Ja(this,a)},union:function(){return Fa(this.concat(Ka(arguments)))},intersect:function(){return Ha(this,Ka(arguments),n)},subtract:function(){return Ha(this,Ka(arguments),k)},at:function(){return
|
1
|
+
function Ba(a,b,c,d){var e=k;if(a===b)return k;else if(D(b)&&C(a))return r(b).test(a);else if(A(b))return b.apply(c,d);else if(M(b)&&ka(a)){G(b,function(f){Ba(a[f],b[f],c,[a[f],a])||(e=n)});return e}else return va(a)&&va(b)?ua(a)===ua(b):a===b}function R(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
2
|
+
function T(a,b,c,d){var e,f;if(c<0)c=a.length+c;f=isNaN(c)?0:c;for(c=d===k?a.length+f:a.length;f<c;){e=f%a.length;if(e in a){if(b.call(a,a[e],e,a)===n)break}else return Ca(a,b,f,d);f++}}function Ca(a,b,c){var d=[],e;for(e in a)e in a&&e>>>0==e&&e!=4294967295&&e>=c&&d.push(parseInt(e));d.sort().each(function(f){return b.call(a,a[f],f,a)});return a}function Ea(a,b,c,d,e){var f,h;T(a,function(i,j,g){if(Ba(i,b,g,[i,j,g])){f=i;h=j;return n}},c,d);return e?h:f}
|
3
|
+
function Fa(a,b){var c=[],d={},e;T(a,function(f,h){e=b?R(f,b,a,[f,h,a]):f;Ga(d,e)||c.push(f)});return c}function Ha(a,b,c){var d=[],e={};b.each(function(f){Ga(e,f)});a.each(function(f){var h=ua(f),i=!va(f);if(Ia(e,h,f,i)!=c){var j=0;if(i)for(h=e[h];j<h.length;)if(h[j]===f)h.splice(j,1);else j+=1;else delete e[h];d.push(f)}});return d}function Ja(a,b,c){b=b||Infinity;c=c||0;var d=[];T(a,function(e){if(da(e)&&c<b)d=d.concat(Ja(e,b,c+1));else d.push(e)});return d}
|
4
|
+
function Ka(a){var b=[];F(a,function(c){b=b.concat(c)});return b}function Ia(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Ga(a,b){var c=ua(b),d=!va(b),e=Ia(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}function La(a,b,c,d){var e,f=[],h=c==="max",i=c==="min",j=Array.isArray(a);G(a,function(g){var m=a[g];g=R(m,b,a,j?[m,parseInt(g),a]:[]);if(g===e)f.push(m);else if(K(e)||h&&g>e||i&&g<e){f=[m];e=g}});j||(f=Ja(f,1));return d?f:f[0]}
|
5
|
+
function Ma(a){if(q[Na])a=a.toLowerCase();return a.replace(q[Oa],"")}function Pa(a,b){var c=a.charAt(b);return(q[Qa]||{})[c]||c}function Ra(a){var b=q[Sa];return a?b.indexOf(a):l}var Sa="AlphanumericSortOrder",Oa="AlphanumericSortIgnore",Na="AlphanumericSortIgnoreCase",Qa="AlphanumericSortEquivalents";E(q,n,n,{create:function(){var a=[],b;F(arguments,function(c){if(ka(c))try{b=q.prototype.slice.call(c,0);if(b.length>0)c=b}catch(d){}a=a.concat(c)});return a}});
|
6
|
+
E(q,k,n,{find:function(a,b,c){return Ea(this,a,b,c)},findAll:function(a,b,c){var d=[];T(this,function(e,f,h){Ba(e,a,h,[e,f,h])&&d.push(e)},b,c);return d},findIndex:function(a,b,c){a=Ea(this,a,b,c,k);return K(a)?-1:a},count:function(a){if(K(a))return this.length;return this.findAll(a).length},removeAt:function(a,b){if(K(a))return this;if(K(b))b=a;for(var c=0;c<=b-a;c++)this.splice(a,1);return this},include:function(a,b){return this.clone().add(a,b)},exclude:function(){return q.prototype.remove.apply(this.clone(),
|
7
|
+
arguments)},clone:function(){return ma([],this)},unique:function(a){return Fa(this,a)},flatten:function(a){return Ja(this,a)},union:function(){return Fa(this.concat(Ka(arguments)))},intersect:function(){return Ha(this,Ka(arguments),n)},subtract:function(){return Ha(this,Ka(arguments),k)},at:function(){return wa(this,arguments)},first:function(a){if(K(a))return this[0];if(a<0)a=0;return this.slice(0,a)},last:function(a){if(K(a))return this[this.length-1];return this.slice(this.length-a<0?0:this.length-
|
8
8
|
a)},from:function(a){return this.slice(a)},to:function(a){if(K(a))a=this.length;return this.slice(0,a)},min:function(a,b){return La(this,a,"min",b)},max:function(a,b){return La(this,a,"max",b)},least:function(a,b){return La(this.groupBy.apply(this,[a]),"length","min",b)},most:function(a,b){return La(this.groupBy.apply(this,[a]),"length","max",b)},sum:function(a){a=a?this.map(a):this;return a.length>0?a.reduce(function(b,c){return b+c}):0},average:function(a){a=a?this.map(a):this;return a.length>0?
|
9
|
-
a.sum()/a.length:0},inGroups:function(a,b){var c=arguments.length>1,d=this,e=[],
|
10
|
-
0},sortBy:function(a,b){var c=this.clone();c.sort(function(d,e){var
|
11
|
-
d),c=a[--d],a[d]=a[b],a[b]=c);return a},zip:function(){var a=F(arguments);return this.map(function(b,c){return[b].concat(a.map(function(d){return c in d?d[c]:l}))})},sample:function(a){var b=
|
12
|
-
|
13
|
-
|
14
|
-
E(p,n,n,{map:function(a,b){return Ta(a).reduce(function(c,d){c[d]=R(a[d],b,a,[d,a[d],a]);return c},{})},reduce:function(a){var b=Ta(a).map(function(c){return a[c]});return b.reduce.apply(b,F(arguments).slice(1))},
|
9
|
+
a.sum()/a.length:0},inGroups:function(a,b){var c=arguments.length>1,d=this,e=[],f=N(this.length/a,void 0,"ceil");oa(0,a-1,function(h){h=h*f;var i=d.slice(h,h+f);c&&i.length<f&&oa(1,f-i.length,function(){i=i.add(b)});e.push(i)});return e},inGroupsOf:function(a,b){var c=[],d=this.length,e=this,f;if(d===0||a===0)return e;if(K(a))a=1;if(K(b))b=l;oa(0,N(d/a,void 0,"ceil")-1,function(h){for(f=e.slice(a*h,a*h+a);f.length<a;)f.push(b);c.push(f)});return c},isEmpty:function(){return this.compact().length==
|
10
|
+
0},sortBy:function(a,b){var c=this.clone();c.sort(function(d,e){var f,h;f=R(d,a,c,[d]);h=R(e,a,c,[e]);if(C(f)&&C(h)){f=f;h=h;var i,j,g,m,o=0,v=0;f=Ma(f);h=Ma(h);do{g=Pa(f,o);m=Pa(h,o);i=Ra(g);j=Ra(m);if(i===-1||j===-1){i=f.charCodeAt(o)||l;j=h.charCodeAt(o)||l}g=g!==f.charAt(o);m=m!==h.charAt(o);if(g!==m&&v===0)v=g-m;o+=1}while(i!=l&&j!=l&&i===j);f=i===j?v:i<j?-1:1}else f=f<h?-1:f>h?1:0;return f*(b?-1:1)});return c},randomize:function(){for(var a=this.concat(),b,c,d=a.length;d;b=parseInt(w.random()*
|
11
|
+
d),c=a[--d],a[d]=a[b],a[b]=c);return a},zip:function(){var a=F(arguments);return this.map(function(b,c){return[b].concat(a.map(function(d){return c in d?d[c]:l}))})},sample:function(a){var b=this.randomize();return arguments.length>0?b.slice(0,a):b[0]},each:function(a,b,c){T(this,a,b,c);return this},add:function(a,b){if(!B(u(b))||isNaN(b))b=this.length;q.prototype.splice.apply(this,[b,0].concat(a));return this},remove:function(){var a,b=this;F(arguments,function(c){for(a=0;a<b.length;)if(Ba(b[a],
|
12
|
+
c,b,[b[a],a,b]))b.splice(a,1);else a++});return b},compact:function(a){var b=[];T(this,function(c){if(da(c))b.push(c.compact());else if(a&&c)b.push(c);else!a&&c!=l&&c.valueOf()===c.valueOf()&&b.push(c)});return b},groupBy:function(a,b){var c=this,d={},e;T(c,function(f,h){e=R(f,a,c,[f,h,c]);d[e]||(d[e]=[]);d[e].push(f)});b&&G(d,b);return d},none:function(){return!this.any.apply(this,arguments)}});E(q,k,n,{all:q.prototype.every,any:q.prototype.some,insert:q.prototype.add});
|
13
|
+
function Ta(a){if(a&&a.valueOf)a=a.valueOf();return p.keys(a)}function Ua(a,b){H(p,n,n,a,function(c,d){c[d]=function(e,f,h){var i=Ta(e);h=q.prototype[d].call(i,function(j){return b?R(e[j],f,e,[j,e[j],e]):Ba(e[j],f,e,[j,e[j],e])},h);if(da(h))h=h.reduce(function(j,g){j[g]=e[g];return j},{});return h}});xa(a,na)}
|
14
|
+
E(p,n,n,{map:function(a,b){return Ta(a).reduce(function(c,d){c[d]=R(a[d],b,a,[d,a[d],a]);return c},{})},reduce:function(a){var b=Ta(a).map(function(c){return a[c]});return b.reduce.apply(b,F(arguments).slice(1))},each:function(a,b){ja(b);G(a,b);return a},size:function(a){return Ta(a).length}});
|
15
|
+
(function(){H(q,k,function(){var a=arguments;return a.length>0&&!A(a[0])},"map,every,all,some,any,none,filter",function(a,b){a[b]=function(c){return this[b](function(d,e){return b==="map"?R(d,c,this,[d,e,this]):Ba(d,c,this,[d,e,this])})}})})();
|
15
16
|
(function(){q[Sa]="A\u00c1\u00c0\u00c2\u00c3\u0104BC\u0106\u010c\u00c7D\u010e\u00d0E\u00c9\u00c8\u011a\u00ca\u00cb\u0118FG\u011eH\u0131I\u00cd\u00cc\u0130\u00ce\u00cfJKL\u0141MN\u0143\u0147\u00d1O\u00d3\u00d2\u00d4PQR\u0158S\u015a\u0160\u015eT\u0164U\u00da\u00d9\u016e\u00db\u00dcVWXY\u00ddZ\u0179\u017b\u017d\u00de\u00c6\u0152\u00d8\u00d5\u00c5\u00c4\u00d6".split("").map(function(b){return b+b.toLowerCase()}).join("");var a={};T("A\u00c1\u00c0\u00c2\u00c3\u00c4,C\u00c7,E\u00c9\u00c8\u00ca\u00cb,I\u00cd\u00cc\u0130\u00ce\u00cf,O\u00d3\u00d2\u00d4\u00d5\u00d6,S\u00df,U\u00da\u00d9\u00db\u00dc".split(","),
|
16
|
-
function(b){var c=b.charAt(0);T(b.slice(1).split(""),function(d){a[d]=c;a[d.toLowerCase()]=c.toLowerCase()})});q[Na]=k;q[Qa]=a})();Ua("
|
17
|
+
function(b){var c=b.charAt(0);T(b.slice(1).split(""),function(d){a[d]=c;a[d.toLowerCase()]=c.toLowerCase()})});q[Na]=k;q[Qa]=a})();Ua("any,all,none,count,find,findAll,isEmpty");Ua("sum,average,min,max,least,most",k);xa("map,reduce,size",na);
|
@@ -1,9 +1,9 @@
|
|
1
|
-
var k=true,l=null,n=false;function aa(a){return function(){return a}}var p=Object,q=Array,r=RegExp,s=Date,t=String,u=Number,
|
2
|
-
function
|
3
|
-
function H(a,b,c,d,e){var
|
4
|
-
function ka(a){return a&&typeof a==="object"}function
|
5
|
-
function
|
6
|
-
function ra(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function
|
7
|
-
function
|
8
|
-
function
|
9
|
-
function
|
1
|
+
var k=true,l=null,n=false;function aa(a){return function(){return a}}var p=Object,q=Array,r=RegExp,s=Date,t=String,u=Number,w=Math,ba=typeof global!=="undefined"?global:this,ca=p.defineProperty&&p.defineProperties,x="Array,Boolean,Date,Function,Number,String,RegExp".split(","),da=z(x[0]),ea=z(x[1]),fa=z(x[2]),A=z(x[3]),B=z(x[4]),C=z(x[5]),D=z(x[6]);function z(a){return function(b){return p.prototype.toString.call(b)==="[object "+a+"]"}}
|
2
|
+
function ga(a){if(!a.SugarMethods){ha(a,"SugarMethods",{});E(a,n,n,{restore:function(){var b=arguments.length===0,c=F(arguments);G(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ha(e.wa?a.prototype:a,d,e.method)})},extend:function(b,c,d){E(a,d!==n,c,b)}})}}function E(a,b,c,d){var e=b?a.prototype:a,f;ga(a);G(d,function(h,i){f=e[h];if(typeof c==="function")i=ia(e[h],i,c);if(c!==n||!e[h])ha(e,h,i);a.SugarMethods[h]={wa:b,method:i,Da:f}})}
|
3
|
+
function H(a,b,c,d,e){var f={};d=C(d)?d.split(","):d;d.forEach(function(h,i){e(f,h,i)});E(a,b,c,f)}function ia(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ha(a,b,c){if(ca)p.defineProperty(a,b,{value:c,configurable:k,enumerable:n,writable:k});else a[b]=c}function F(a,b){var c=[],d;for(d=0;d<a.length;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}
|
4
|
+
function ja(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}function I(a){return a!==void 0}function K(a){return a===void 0}function ka(a){return a&&typeof a==="object"}function M(a){return!!a&&p.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}function la(a,b){return p.hasOwnProperty.call(a,b)}function G(a,b){for(var c in a)if(la(a,c))if(b.call(a,c,a[c],a)===n)break}function ma(a,b){G(b,function(c){a[c]=b[c]});return a}function na(a){ma(this,a)}
|
5
|
+
na.prototype.constructor=p;function oa(a,b,c,d){var e=[];a=parseInt(a);for(var f=d<0;!f&&a<=b||f&&a>=b;){e.push(a);c&&c.call(this,a);a+=d||1}return e}function N(a,b,c){c=w[c||"round"];var d=w.pow(10,w.abs(b||0));if(b<0)d=1/d;return c(a*d)/d}function pa(a,b){return N(a,b,"floor")}function O(a,b,c,d){d=w.abs(a).toString(d||10);d=qa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}
|
6
|
+
function ra(a){if(a>=11&&a<=13)return"th";else switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function sa(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function qa(a,b){return q(w.max(0,I(a)?a:1)+1).join(b||"")}function ta(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}
|
7
|
+
function Q(a){C(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}function ua(a,b){var c=typeof a,d,e,f,h,i,j;if(c==="string")return a;f=p.prototype.toString.call(a);d=M(a);e=f==="[object Array]";if(a!=l&&d||e){b||(b=[]);if(b.length>1)for(j=b.length;j--;)if(b[j]===a)return"CYC";b.push(a);d=t(a.constructor);h=e?a:p.keys(a).sort();for(j=0;j<h.length;j++){i=e?j:h[j];d+=i+ua(a[i],b)}b.pop()}else d=1/a===-Infinity?"-0":t(a&&a.valueOf?a.valueOf():a);return c+f+d}
|
8
|
+
function va(a){var b=p.prototype.toString.call(a);return b==="[object Date]"||b==="[object Array]"||b==="[object String]"||b==="[object Number]"||b==="[object RegExp]"||b==="[object Boolean]"||b==="[object Arguments]"||M(a)}function wa(a,b,c){var d=[],e=a.length,f=b[b.length-1]!==n,h;F(b,function(i){if(ea(i))return n;if(f){i%=e;if(i<0)i=e+i}h=c?a.charAt(i)||"":a[i];d.push(h)});return d.length<2?d[0]:d}
|
9
|
+
function xa(a,b){H(b,k,n,a,function(c,d){c[d+(d==="equal"?"s":"")]=function(){return p[d].apply(l,[this].concat(F(arguments)))}})}ga(p);G(x,function(a,b){ga(ba[b])});
|