UNPKG

@piyawasin/attempt

Version:

A minimal, type-safe utility for defensive error handling in JS/TS. Inspired by Go, it uses tuple-based returns to eliminate try-catch nesting and handle synchronous/asynchronous errors predictably.

50 lines (49 loc) 1.47 kB
{ "name": "@piyawasin/attempt", "version": "2.0.2", "description": "A minimal, type-safe utility for defensive error handling in JS/TS. Inspired by Go, it uses tuple-based returns to eliminate try-catch nesting and handle synchronous/asynchronous errors predictably.", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", "types": "dist/types/index.d.ts", "exports": { ".": { "require": "./dist/cjs/index.js", "import": "./dist/esm/index.js", "types": "./dist/types/index.d.ts" } }, "files": [ "dist/" ], "scripts": { "build:esm": "tsc --project tsconfig.json", "build:cjs": "tsc --project tsconfig.cjs.json", "build": "npm run build:esm && npm run build:cjs", "clean": "rm -rf dist", "prepublishOnly": "npm run clean && npm run build", "release:patch": "npm version patch && npm publish --access public", "release:minor": "npm version minor && npm publish --access public", "release:major": "npm version major && npm publish --access public", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Piyawasin Pikror-ngarn", "license": "ISC", "keywords": [ "error", "handling", "function", "error-handling", "exception", "go", "golang", "sugar" ], "repository": { "type": "git", "url": "https://github.com/ppikrorngarn/attempt" }, "readme": "README.md", "devDependencies": { "typescript": "^4.6.2" } }