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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 leadZero2(this.getMinutes()) + ":" + | 474 leadZero2(this.getMinutes()) + ":" + |
475 leadZero2(this.getSeconds()) + "." + | 475 leadZero2(this.getSeconds()) + "." + |
476 leadZero3(this.getMilliseconds()); | 476 leadZero3(this.getMilliseconds()); |
477 } | 477 } |
478 | 478 |
479 Object.defineProperty(Array.prototype, "remove", | 479 Object.defineProperty(Array.prototype, "remove", |
480 { | 480 { |
481 /** | 481 /** |
482 * @param {!T} value | 482 * @param {!T} value |
483 * @param {boolean=} firstOnly | 483 * @param {boolean=} firstOnly |
| 484 * @return {boolean} |
484 * @this {Array.<!T>} | 485 * @this {Array.<!T>} |
485 * @template T | 486 * @template T |
486 */ | 487 */ |
487 value: function(value, firstOnly) | 488 value: function(value, firstOnly) |
488 { | 489 { |
489 var index = this.indexOf(value); | 490 var index = this.indexOf(value); |
490 if (index === -1) | 491 if (index === -1) |
491 return; | 492 return false; |
492 if (firstOnly) { | 493 if (firstOnly) { |
493 this.splice(index, 1); | 494 this.splice(index, 1); |
494 return; | 495 return true; |
495 } | 496 } |
496 for (var i = index + 1, n = this.length; i < n; ++i) { | 497 for (var i = index + 1, n = this.length; i < n; ++i) { |
497 if (this[i] !== value) | 498 if (this[i] !== value) |
498 this[index++] = this[i]; | 499 this[index++] = this[i]; |
499 } | 500 } |
500 this.length = index; | 501 this.length = index; |
| 502 return true; |
501 } | 503 } |
502 }); | 504 }); |
503 | 505 |
504 Object.defineProperty(Array.prototype, "keySet", | 506 Object.defineProperty(Array.prototype, "keySet", |
505 { | 507 { |
506 /** | 508 /** |
507 * @return {!Object.<string, boolean>} | 509 * @return {!Object.<string, boolean>} |
508 * @this {Array.<*>} | 510 * @this {Array.<*>} |
509 */ | 511 */ |
510 value: function() | 512 value: function() |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 * @param {T} defaultValue | 1494 * @param {T} defaultValue |
1493 * @return {!Promise.<T>} | 1495 * @return {!Promise.<T>} |
1494 * @template T | 1496 * @template T |
1495 */ | 1497 */ |
1496 Promise.prototype.catchException = function(defaultValue) { | 1498 Promise.prototype.catchException = function(defaultValue) { |
1497 return this.catch(function (error) { | 1499 return this.catch(function (error) { |
1498 console.error(error); | 1500 console.error(error); |
1499 return defaultValue; | 1501 return defaultValue; |
1500 }); | 1502 }); |
1501 } | 1503 } |
OLD | NEW |