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
/** | |
* Moves to the end all "falsy" items within the array (this). | |
* | |
* Could be used for extending Array.prototype: | |
* Array.prototype.separate = separate; | |
* | |
* @param [test] {Function} - function to determine whether an item is falsy | |
* if not provided, "falsy" is Boolean(value) except zero. | |
* @returns {number} - first "falsy" item index | |
*/ |
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
/** | |
* Compares a date with today in the client's time zone. The comparison is day-wise, | |
* so that all dates since today's midnight till the next midnight are considered "today". | |
* Yesterday and tomorrow are separate from the past and future. | |
* | |
* @param dateRepresentation {string|number|Date} | |
* @returns {number} | |
* +2 - date is in the future (after tomorrow) | |
* +1 - tomorrow | |
* 0 - today |