OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return chunkb.length - chunka.length; | 280 return chunkb.length - chunka.length; |
281 } | 281 } |
282 } else if (chunka !== chunkb) | 282 } else if (chunka !== chunkb) |
283 return (chunka < chunkb) ? -1 : 1; | 283 return (chunka < chunkb) ? -1 : 1; |
284 a = a.substring(chunka.length); | 284 a = a.substring(chunka.length); |
285 b = b.substring(chunkb.length); | 285 b = b.substring(chunkb.length); |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 /** | 289 /** |
| 290 * @param {string} name |
| 291 * @param {number=} arrayLength |
| 292 * @return {boolean} |
| 293 */ |
| 294 String.isArrayIndexPropertyName = function(name, arrayLength) |
| 295 { |
| 296 // Array index check according to the ES5-15.4. |
| 297 var index = name >>> 0; |
| 298 return String(index) === name && index !== 0xffffffff && (typeof arrayLength
=== "undefined" || index < arrayLength); |
| 299 } |
| 300 |
| 301 /** |
290 * @param {number} num | 302 * @param {number} num |
291 * @param {number} min | 303 * @param {number} min |
292 * @param {number} max | 304 * @param {number} max |
293 * @return {number} | 305 * @return {number} |
294 */ | 306 */ |
295 Number.constrain = function(num, min, max) | 307 Number.constrain = function(num, min, max) |
296 { | 308 { |
297 if (num < min) | 309 if (num < min) |
298 num = min; | 310 num = min; |
299 else if (num > max) | 311 else if (num > max) |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 { | 1506 { |
1495 console.assert(this._pendingIncomingCallbacksCount > 0); | 1507 console.assert(this._pendingIncomingCallbacksCount > 0); |
1496 if (userCallback) { | 1508 if (userCallback) { |
1497 var args = Array.prototype.slice.call(arguments, 1); | 1509 var args = Array.prototype.slice.call(arguments, 1); |
1498 userCallback.apply(null, args); | 1510 userCallback.apply(null, args); |
1499 } | 1511 } |
1500 if (!--this._pendingIncomingCallbacksCount && this._outgoingCallback) | 1512 if (!--this._pendingIncomingCallbacksCount && this._outgoingCallback) |
1501 this._outgoingCallback(); | 1513 this._outgoingCallback(); |
1502 } | 1514 } |
1503 } | 1515 } |
OLD | NEW |