(object)
| 41 | } |
| 42 | |
| 43 | function clone(object) { |
| 44 | var newObject; |
| 45 | var i; |
| 46 | var len; |
| 47 | |
| 48 | if (!object || typeof object !== 'object') { |
| 49 | return object; |
| 50 | } |
| 51 | |
| 52 | if (Array.isArray(object)) { |
| 53 | newObject = []; |
| 54 | for (i = 0, len = object.length; i < len; i++) { |
| 55 | newObject[i] = clone(object[i]); |
| 56 | } |
| 57 | return newObject; |
| 58 | } |
| 59 | |
| 60 | // special case: to avoid inconsistencies between IndexedDB |
| 61 | // and other backends, we automatically stringify Dates |
| 62 | if (object instanceof Date && isFinite(object)) { |
| 63 | return object.toISOString(); |
| 64 | } |
| 65 | |
| 66 | if (isBinaryObject(object)) { |
| 67 | return cloneBinaryObject(object); |
| 68 | } |
| 69 | |
| 70 | if (!isPlainObject(object)) { |
| 71 | return object; // don't clone objects like Workers |
| 72 | } |
| 73 | |
| 74 | newObject = {}; |
| 75 | for (i in object) { |
| 76 | /* istanbul ignore else */ |
| 77 | if (Object.prototype.hasOwnProperty.call(object, i)) { |
| 78 | var value = clone(object[i]); |
| 79 | if (typeof value !== 'undefined') { |
| 80 | newObject[i] = value; |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | return newObject; |
| 85 | } |
| 86 | |
| 87 | function once(fun) { |
| 88 | var called = false; |
no test coverage detected
searching dependent graphs…