scratch – Diff between revs 75 and 125
?pathlinks?
Rev 75 | Rev 125 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | // Generated by CoffeeScript 1.10.0 |
1 | // Generated by CoffeeScript 1.12.4 |
|
2 | var Pattern, Utils; |
2 | var Pattern, Utils, |
|
- | 3 | hasProp = {}.hasOwnProperty; |
||
Line 3... | Line 4... | |||
3 | |
4 | |
|
Line 4... | Line 5... | |||
4 | Pattern = require('./Pattern'); |
5 | Pattern = require('./Pattern'); |
|
5 | |
6 | |
|
Line 25... | Line 26... | |||
25 | Utils.trim = function(str, _char) { |
26 | Utils.trim = function(str, _char) { |
|
26 | var regexLeft, regexRight; |
27 | var regexLeft, regexRight; |
|
27 | if (_char == null) { |
28 | if (_char == null) { |
|
28 | _char = '\\s'; |
29 | _char = '\\s'; |
|
29 | } |
30 | } |
|
30 | return str.trim(); |
- | ||
31 | regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; |
31 | regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; |
|
32 | if (regexLeft == null) { |
32 | if (regexLeft == null) { |
|
33 | this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); |
33 | this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); |
|
34 | } |
34 | } |
|
35 | regexLeft.lastIndex = 0; |
35 | regexLeft.lastIndex = 0; |
|
Line 66... | Line 66... | |||
66 | regexRight.lastIndex = 0; |
66 | regexRight.lastIndex = 0; |
|
67 | return str.replace(regexRight, ''); |
67 | return str.replace(regexRight, ''); |
|
68 | }; |
68 | }; |
|
Line 69... | Line 69... | |||
69 | |
69 | |
|
70 | Utils.isEmpty = function(value) { |
70 | Utils.isEmpty = function(value) { |
|
- | 71 | return !value || value === '' || value === '0' || (value instanceof Array && value.length === 0) || this.isEmptyObject(value); |
||
- | 72 | }; |
||
- | 73 | |
||
- | 74 | Utils.isEmptyObject = function(value) { |
||
- | 75 | var k; |
||
- | 76 | return value instanceof Object && ((function() { |
||
- | 77 | var results; |
||
- | 78 | results = []; |
||
- | 79 | for (k in value) { |
||
- | 80 | if (!hasProp.call(value, k)) continue; |
||
- | 81 | results.push(k); |
||
- | 82 | } |
||
- | 83 | return results; |
||
71 | return !value || value === '' || value === '0' || (value instanceof Array && value.length === 0); |
84 | })()).length === 0; |
|
Line 72... | Line 85... | |||
72 | }; |
85 | }; |
|
73 | |
86 | |
|
74 | Utils.subStrCount = function(string, subString, start, length) { |
87 | Utils.subStrCount = function(string, subString, start, length) { |
|
Line 198... | Line 211... | |||
198 | tz_offset *= -1; |
211 | tz_offset *= -1; |
|
199 | } |
212 | } |
|
200 | } |
213 | } |
|
201 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); |
214 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); |
|
202 | if (tz_offset) { |
215 | if (tz_offset) { |
|
203 | date.setTime(date.getTime() + tz_offset); |
216 | date.setTime(date.getTime() - tz_offset); |
|
204 | } |
217 | } |
|
205 | return date; |
218 | return date; |
|
206 | }; |
219 | }; |
|
Line 207... | Line 220... | |||
207 | |
220 | |
|
Line 229... | Line 242... | |||
229 | ref = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; |
242 | ref = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; |
|
230 | for (j = 0, len1 = ref.length; j < len1; j++) { |
243 | for (j = 0, len1 = ref.length; j < len1; j++) { |
|
231 | name = ref[j]; |
244 | name = ref[j]; |
|
232 | try { |
245 | try { |
|
233 | xhr = new ActiveXObject(name); |
246 | xhr = new ActiveXObject(name); |
|
234 | } catch (undefined) {} |
247 | } catch (error) {} |
|
235 | } |
248 | } |
|
236 | } |
249 | } |
|
237 | } |
250 | } |
|
238 | if (xhr != null) { |
251 | if (xhr != null) { |
|
239 | if (callback != null) { |
252 | if (callback != null) { |