Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@gotamedia/utils

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gotamedia/utils - npm Package Compare versions

Comparing version
0.0.3
to
0.1.0
+11
-0
CHANGELOG.md

@@ -5,2 +5,13 @@ # Changelog

## [0.1.0](https://bitbucket.org/gotamedia/utils/compare/0.1.0..0.0.3) (2023-05-29)
### ⚠ BREAKING CHANGES
* Introduced @gotamedia/utils package.
### Features
* Introduced @gotamedia/utils package. ([d94fd96](https://bitbucket.org/gotamedia/utils/commits/d94fd96d2c485cfbdc774460133acb65fff104c7))
## [0.0.3](https://bitbucket.org/gotamedia/utils/compare/0.0.3..0.0.2) (2023-05-26)

@@ -7,0 +18,0 @@

+1
-1
{
"name": "@gotamedia/utils",
"version": "0.0.3",
"version": "0.1.0",
"private": false,

@@ -5,0 +5,0 @@ "description": "Set of Utils helper for NodeJs Runtime.",

# Gota Media Utils
Set of Utils helpers for NodeJs Runtime.
Set of Utils helpers for NodeJs Runtime.
## Usage
```sh
npm install @gotamedia/utils
```
```ts
import { logError } from "@gotamedia/utils/logError"
const handler = () => {
logError(new Error("Oops!"))
}
```
## Utils
Available utils:
* logError
* getErrorTrace
* sourceMapSupport
#### Available methods:
##### logError()
A helper function to log errors with traces
| param | type | default | required | description |
|--------|-------|-----------|----------|----------------------------------------------------------------------------|
| first | Error | undefined | | Error object to parse and log with traces |
| second | any | undefined | | Any additional info that will be added to the output under `ìnfo` property |
**Example:**
```ts
import logError from "@gotamedia/utils/logError"
const handler = async () => {
const trakingId = "123-321"
try {
...
const response = await fetch(`www.example.com/id/${trakingId}`)
...
} catch (error) {
logError(
error,
{
trakingId: trakingId,
message: "Oops! Something went wrong here.",
reason: "Failed to do something because of something"
}
)
}
}
```
##### getErrorTrace()
A helper function to extract trace from Error object
| param | type | default | required | description |
|--------|-------|-------------|----------|------------------------------------|
| first | Error | new Error() | | Error object to extract trace from |
**Example:**
```ts
import { getErrorTrace } from "@gotamedia/utils/getErrorTrace"
const handler = async () => {
try {
...
} catch (error) {
const trace = getErrorTrace(error)
console.log(trace)
}
}
```
##### sourceMapSupport
A helper util to parse source-maps from your "un-minified" Lambda code if you bundle and minify your Lambda
> **_NOTE:_** If you want to support source-map this import needs to be the first import statement in your entry file.
**Example:**
```ts
import "@gotamedia/utils/sourceMapSupport"
const handler = async () => {
...
}
```