A collection of tiny JavaScript utilities
-
camelize
Converts string to camelCase.
- Example:
camelize("hello world") // "helloWorld"
-
getAvgColorOfImg
Calculates average image color.
- Example:
getAvgColorOfImg(imageElement) // e.g., "#7f8c8d"
-
Update getAvgColorOfImg
Updated average color calculation.
- Example:
getAvgColorOfImg(newImageElement) // e.g., "#bdc3c7"
-
getMonthNameFromDateString
Extracts month name from date.
- Example:
getMonthNameFromDateString("2023-12-18") // "December"
-
getMonthNumberFromMonthName
Gets month number from name.
- Example:
getMonthNumberFromMonthName("March") // 3
-
getOS
Identifies operating system.
- Example:
getOS() // e.g., "Windows"
-
getSystemInfo
Retrieves system information.
- Example:
getSystemInfo() // { os: "Linux", browser: "Firefox", ... }
-
isDev
Checks development environment.
- Example:
isDev() // true or false
-
isEven
Checks if number is even.
- Example:
isEven(4) // true
-
isOdd
Checks if number is odd.
- Example:
isOdd(5) // true
-
isTodayOrFuture
Checks if date is today/future.
- Example:
isTodayOrFuture("2023-12-18") // true or false
-
shadeColor
Adjusts color shade.
- Example:
shadeColor("#ff5733", -20) // Darker color
-
slugify
Creates URL-friendly slug.
- Example:
slugify("Hello World!") // "hello-world"