My personal collection of typescript utility functions.
__tests__ | ||
lib | ||
src | ||
.editorconfig | ||
.eslintrc.cjs | ||
.gitattributes | ||
.gitignore | ||
.jshintrc | ||
.prettierignore | ||
jest.config.js | ||
jsconfig.json | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md | ||
TODDO.md | ||
tsconfig-cjs.json | ||
tsconfig.json |
ItsEricWoodward's Utils
A small collection of common libraries and functions I like to use in my Node applications.
I figure that publishing them in a public repo on my gitea instance will make them easier to use.
The functions exported by this library are:
- convertCamelToUpperSnakeCase(
str
: string)- Converts textLikeThis (or TextLikeThis) to TEXT_LIKE_THIS.
- Returns: Converted version of
str
- getDirname()
- Reads and returns variables
__dirname
and__filename
, as with CJS Node. - Returns: {
__dirname
: string,__filename
: string }
- Reads and returns variables
- getTime()
- Returns: the current time in a standardized format.
- log(
...msg
: unknown[])- Prints the contents of
msg
to the console with my preferred formatting.
- Prints the contents of
- readJsonIfExists(
filePath
: string | URL)- Reads the contents of the JSON or JSON5 file at indicated
filePath
. - Returns: the
JSON.parse
d contents of the file.
- Reads the contents of the JSON or JSON5 file at indicated