-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d89336
commit ef8f922
Showing
8 changed files
with
291 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Handlebars Array Helpers | ||
* | ||
* @source https://github.com/helpers/handlebars-helpers | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
|
||
|
||
|
||
/** | ||
* Color Hex Random | ||
* | ||
* Return random color hex format | ||
* | ||
* @param option. | ||
*/ | ||
module.exports = (value, options) => { | ||
|
||
// Generate a random integer between 0 and 16777215 (0xFFFFFF) | ||
const randomColor = Math.floor(Math.random() * 16777216); | ||
|
||
// Convert to hexadecimal and pad with leading zeros if necessary | ||
return `#${randomColor.toString(16).padStart(6, '0')}`; | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Handlebars Array Helpers | ||
* | ||
* @source https://github.com/helpers/handlebars-helpers | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
|
||
/** | ||
* Length | ||
* | ||
* Returns the length of the given string or array. | ||
* | ||
* @param any value | ||
* @param Object options | ||
* | ||
* @return number | ||
*/ | ||
module.exports = (value, options) => { | ||
|
||
// Check if array or string | ||
if(typeof value === 'number') | ||
|
||
// Return lenght | ||
return parseFloat(value.toFixed(1)); | ||
|
||
// Return 0 | ||
return value; | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.