UNPKG

@e-group/utils

Version:

eGroup team utils that share across projects.

30 lines (25 loc) 474 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = hasIn; /** * Does value has in object */ function hasIn(obj, paths) { let copy = obj; let result = false; for (let i = 0; i < paths.length; i++) { const key = paths[i]; if (copy[key] != null) { if (i === paths.length - 1) { result = true; } else { copy = copy[key]; } } else { break; } } return result; }