on-error-resume-next
Advanced tools
Comparing version 1.2.1-master.657032b to 2.0.0-main.8668b8f
{ | ||
"name": "on-error-resume-next", | ||
"version": "1.2.1-master.657032b", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"version": "2.0.0-main.8668b8f", | ||
"description": "Run a function, synchronously or asynchronously, and ignore errors.", | ||
"files": [ | ||
"lib/**/*" | ||
"./dist/" | ||
], | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/on-error-resume-next.d.mts", | ||
"default": "./dist/on-error-resume-next.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/on-error-resume-next.d.ts", | ||
"default": "./dist/on-error-resume-next.js" | ||
} | ||
}, | ||
"./async": { | ||
"import": { | ||
"types": "./dist/on-error-resume-next.async.d.mts", | ||
"default": "./dist/on-error-resume-next.async.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/on-error-resume-next.async.d.ts", | ||
"default": "./dist/on-error-resume-next.async.js" | ||
} | ||
} | ||
}, | ||
"main": "./dist/on-error-resume-next.js", | ||
"typings": "./dist/on-error-resume-next.d.ts", | ||
"scripts": { | ||
"build": "babel --out-dir lib src --ignore **/*.spec.js,**/*.test.js", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls", | ||
"prestart": "npm run build:babel", | ||
"start": "npm run build:babel -- --skip-initial-build --watch", | ||
"test": "jest --collectCoverage true" | ||
"build": "tsup", | ||
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", | ||
"bump:auditfix": "npm audit fix || exit 0", | ||
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", | ||
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", | ||
"precommit": "npm run precommit:eslint && npm run precommit:typescript:production && npm run precommit:typescript:test", | ||
"precommit:eslint": "eslint ./src/", | ||
"precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json", | ||
"precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json", | ||
"prepack": "cp ../../CHANGELOG.md . && cp ../../LICENSE . && cp ../../README.md .", | ||
"switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json", | ||
"test": "jest" | ||
}, | ||
@@ -20,3 +50,7 @@ "repository": { | ||
}, | ||
"author": "William Wong <compulim@hotmail.com> (http://compulim.info/)", | ||
"keywords": [ | ||
"message-port", | ||
"rpc" | ||
], | ||
"author": "William Wong (https://github.com/compulim)", | ||
"license": "MIT", | ||
@@ -27,15 +61,20 @@ "bugs": { | ||
"homepage": "https://github.com/compulim/on-error-resume-next#readme", | ||
"jest": { | ||
"collectCoverage": true | ||
"pinDependencies": {}, | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.24.6", | ||
"@babel/preset-typescript": "^7.24.6", | ||
"@jest/globals": "^29.7.0", | ||
"@tsconfig/recommended": "^1.0.6", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.12.13", | ||
"esbuild": "^0.21.4", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.2.5", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"babel-jest": "^26.0.1", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"jest": "^26.0.1", | ||
"regenerator-runtime": "^0.13.5" | ||
"dependencies": { | ||
"on-error-resume-next": "^2.0.0-main.8668b8f" | ||
} | ||
} |
@@ -11,2 +11,4 @@ # on-error-resume-next | ||
# Breaking changes | ||
# Usage | ||
@@ -37,12 +39,12 @@ | ||
`onErrorResumeNext` will capture both exceptions (synchronous) and rejections (asynchronous). It is recommended to pair up with `await` keyword to handle both cases in the same way. | ||
`onErrorResumeNext` will capture both exceptions (synchronous) and rejections (asynchronous). | ||
```js | ||
import onErrorResumeNext from 'on-error-resume-next/async'; | ||
const res = await onErrorResumeNext(() => fetch('/health')); | ||
expect(res).toBeUndefined(); | ||
await expect(res).resolves.toBeUndefined(); | ||
``` | ||
> The code is for elaboration only, the better expectation should be `expect(res).resolves.toBeUndefined()`. | ||
# Contributions | ||
@@ -49,0 +51,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13434
15
90
55
1
12