Phyks (Lucas Verney)
fffe9c4cd3
Major code review, cleaning the code and adding a lot of comments. Also implements a separate store to keep entities with a reference count and garbage collection. This closes #15. Known issues at the moment are: * Webplayer is no longer working, it has to be refactored. * AlbumPage is to be implemented.
26 lines
486 B
JavaScript
26 lines
486 B
JavaScript
/**
|
|
* String prototype extension.
|
|
*/
|
|
|
|
|
|
/**
|
|
* Capitalize a string.
|
|
*
|
|
* @return Capitalized string.
|
|
*/
|
|
String.prototype.capitalize = function () {
|
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
};
|
|
|
|
|
|
/**
|
|
* Strip characters at the end of a string.
|
|
*
|
|
* @param chars A regex-like element to strip from the end.
|
|
* @return Stripped string.
|
|
*/
|
|
String.prototype.rstrip = function (chars) {
|
|
let regex = new RegExp(chars + "$");
|
|
return this.replace(regex, "");
|
|
};
|