mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
26 lines
432 B
TypeScript
26 lines
432 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class ObjectService {
|
|
|
|
constructor() { }
|
|
|
|
|
|
deepFind(obj, path):any {
|
|
var paths = path.split('.')
|
|
, current = obj
|
|
, i;
|
|
|
|
for (i = 0; i < paths.length; ++i) {
|
|
if (current[paths[i]] == undefined) {
|
|
return undefined;
|
|
} else {
|
|
current = current[paths[i]];
|
|
}
|
|
}
|
|
return current;
|
|
}
|
|
}
|