(obj: {[k: string]: any} | undefined, depth: number)
| 162 | } |
| 163 | |
| 164 | function shallowObj(obj: {[k: string]: any} | undefined, depth: number): any { |
| 165 | if (!obj || !depth) return null; |
| 166 | const out: {[k: string]: any} = {}; |
| 167 | for (const key in obj) { |
| 168 | if (obj.hasOwnProperty(key)) { |
| 169 | // explicit : any due to https://github.com/microsoft/TypeScript/issues/33191 |
| 170 | let value: any = obj[key]; |
| 171 | switch (typeof value) { |
| 172 | case 'object': |
| 173 | const name = value && value.constructor && (<any>value.constructor).name; |
| 174 | value = name == (<any>Object).name ? shallowObj(value, depth - 1) : name; |
| 175 | break; |
| 176 | case 'function': |
| 177 | value = value.name || undefined; |
| 178 | break; |
| 179 | } |
| 180 | out[key] = value; |
| 181 | } |
| 182 | } |
| 183 | return out; |
| 184 | } |
| 185 | |
| 186 | function zonePathName(zone: Zone) { |
| 187 | let name: string = zone.name; |
no outgoing calls
no test coverage detected