New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

early-return

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

early-return - npm Package Compare versions

Comparing version

to
0.2.0

10

index.ts
let result: any
const errorMessage = 'early-return'
export const early = (value: any, condition?: boolean) => {
if (condition || typeof condition === 'undefined') {
result = value
throw new Error('early-return')
throw new Error(errorMessage)
}

@@ -15,4 +17,6 @@ }

result = method()
} catch (_error) {
// TODO forward otherwise thrown errors.
} catch (_error: any) {
if (_error.message !== errorMessage) {
throw new Error(_error)
}
}

@@ -19,0 +23,0 @@

{
"name": "early-return",
"description": "Helper to facilitate early returns across function stack in JavaScript.",
"version": "0.1.1",
"version": "0.2.0",
"repository": "github:tobua/early-return",

@@ -14,5 +14,5 @@ "license": "MIT",

"@biomejs/biome": "^1.9.4",
"@types/bun": "^1.1.11",
"typescript": "^5.6.3",
"zero-configuration": "^0.17.5"
"@types/bun": "^1.1.14",
"typescript": "^5.7.2",
"zero-configuration": "^0.17.6"
},

@@ -19,0 +19,0 @@ "peerDependencies": {