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
//JSON example | |
{ | |
"ObjectList": [ | |
{ | |
"x": "Starbucks", | |
"y": "asd" | |
}, | |
{ | |
"x": "Starbucks", | |
"y": "asd" |
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
isEmpty(myObject) { | |
for(var key in myObject) { | |
if (myObject.hasOwnProperty(key)) { | |
return false; | |
} | |
} | |
return true; | |
}; |
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
truncate (str, length, ending) { | |
if (length == null) { | |
length = 100; | |
} | |
if (ending == null) { | |
ending = '...'; | |
} | |
if (str.length > length) { | |
return str.substring(0, length - ending.length) + ending; | |
} else { |
NewerOlder