Skip to content

Instantly share code, notes, and snippets.

@hkan
hkan / getDotNotated
Created June 13, 2014 11:15
Object Prototype
Object.defineProperty(Object.prototype, "getDotNotated", {
value: function (dotNotation) {
var arrayOfNames = dotNotation.split('.');
var tmp = this;
for (var i in arrayOfNames) {
if (arrayOfNames.hasOwnProperty(i)) {
tmp = tmp[arrayOfNames[i]];
}
}
@hkan
hkan / README.md
Last active August 29, 2015 14:02
Filter Out Empty Strings of Array

Filter Empty Values

Returns a new array without the empty strings.

Usage

var myArray = [ "hakan", "", "0", 0, false ];

myArray = myArray.filterEmpty();