Skip to content

Commit

Permalink
Updata tsconfig and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrkulpinski committed Dec 1, 2023
1 parent 7be43c3 commit 97a3492
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@curiousleaf/utils",
"description": "A lightweight set of utilities",
"version": "1.0.5",
"version": "1.0.6",
"license": "MIT",
"module": "./dist/index.js",
"type": "module",
Expand Down
6 changes: 4 additions & 2 deletions src/random/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @returns A string representing a random hexadecimal color code.
*/
export const getRandomColor = (): string => {
return Math.floor(Math.random() * 16777215).toString(16)
return Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')
}

/**
Expand All @@ -25,5 +25,7 @@ export const getRandomString = (): string => {
*/
export const getRandomProperty = <T>(obj: { [key: string]: T }): T => {
const keys = Object.keys(obj)
return obj[keys[Math.floor(keys.length * Math.random())]]
const randomKey = keys[Math.floor(keys.length * Math.random())]!

return obj[randomKey]!
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"composite": true,
"strict": true,
"downlevelIteration": true,
"noUncheckedIndexedAccess": true,
"skipLibCheck": true,
"jsx": "preserve",
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 97a3492

Please sign in to comment.