UNPKG

@e-group/utils

Version:

eGroup team utils that share across projects.

18 lines (16 loc) 325 B
/** * delete value in object */ export default function deleteIn(obj, paths) { let copy = obj; for (let i = 0; i < paths.length; i++) { const key = paths[i]; if (i === paths.length - 1) { delete copy[key]; } else if (copy[key] != null) { copy = copy[key]; } else { break; } } }