Created
October 21, 2016 16:10
-
-
Save ypetya/3ce49224b3b657c4f6c16c4f34f4aced to your computer and use it in GitHub Desktop.
Quick an' dirty polyfill for lodash4 unset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unset(o,path) { | |
if(path.indexOf('.')==-1) { | |
delete o[path]; | |
} else { | |
var o2=path.split('.'), | |
ending=o2.pop(); | |
unset(o[o2],ending); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment