You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

modern-errors-bugs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modern-errors-bugs - npm Package Compare versions

Comparing version

to
3.0.0

build/src/main.d.ts

14

build/src/main.js
import{getOptions,BUGS_PREFIX}from"./options.js";
const properties=function({error:{message},options}){
const properties=({error:{message},options})=>{
if(options===undefined){
return{};
return{}
}
const messageA=message.split("\n").filter(hasNoBugsUrl).join("\n");
return{message:`${messageA}\n${options}`};
return{message:`${messageA}\n${options}`}
};
const hasNoBugsUrl=function(line){
return!line.startsWith(BUGS_PREFIX);
};
const hasNoBugsUrl=(line)=>!line.startsWith(BUGS_PREFIX);

@@ -20,3 +18,3 @@ export default{

getOptions,
properties};
//# sourceMappingURL=main.js.map
properties
};
export const getOptions=function(options){
return options===undefined?
options:
`${BUGS_PREFIX}${ensureBugsUrl(options)}`;
};
export const getOptions=(options)=>
options===undefined?options:`${BUGS_PREFIX}${ensureBugsUrl(options)}`;

@@ -14,5 +11,5 @@ export const BUGS_PREFIX="Please report this bug at: ";

const ensureBugsUrl=function(options){
const ensureBugsUrl=(options)=>{
if(Object.prototype.toString.call(options)==="[object URL]"){
return options;
return options
}

@@ -23,31 +20,30 @@

try{
return new URL(options);
return new URL(options)
}catch(error){
throw new TypeError(
`It must not be "${options}" but ${getUrlError(error,options)}`);
`It must not be "${options}" but ${getUrlError(error,options)}`
)
}
};
const validateBugsString=function(options){
const validateBugsString=(options)=>{
if(typeof options!=="string"){
throw new TypeError(`It must be a string or a URL: ${options}`);
throw new TypeError(`It must be a string or a URL: ${options}`)
}
if(options===""){
throw new TypeError("It must not be an empty string");
throw new TypeError("It must not be an empty string")
}
};
const getUrlError=function(error,options){
const getUrlError=(error,options)=>{
try{
new URL(options,EXAMPLE_ORIGIN);
return"an absolute URL.";
return"an absolute URL."
}catch{
return`a valid URL: ${error.message}.`;
return`a valid URL: ${error.message}.`
}
};
const EXAMPLE_ORIGIN="https://example.com";
//# sourceMappingURL=options.js.map
const EXAMPLE_ORIGIN="https://example.com";
{
"name": "modern-errors-bugs",
"version": "2.1.0",
"version": "3.0.0",
"type": "module",
"exports": {
"types": "./build/types/main.d.ts",
"types": "./build/src/main.d.ts",
"default": "./build/src/main.js"
},
"main": "./build/src/main.js",
"types": "./build/types/main.d.ts",
"types": "./build/src/main.d.ts",
"files": [
"build/src/**/*.{js,json}",
"build/types/**/*.d.ts"
"build/src/**/*.{js,json,d.ts}",
"!build/src/**/*.test.js",
"!build/src/{helpers,fixtures}"
],

@@ -50,15 +51,14 @@ "sideEffects": false,

"directories": {
"lib": "src",
"test": "test"
"lib": "src"
},
"devDependencies": {
"@ehmicky/dev-tasks": "^1.0.102",
"test-each": "^5.6.0"
"@ehmicky/dev-tasks": "^2.0.80",
"test-each": "^6.0.0"
},
"peerDependencies": {
"modern-errors": "^5.0.0"
"modern-errors": "^5.5.4"
},
"engines": {
"node": ">=14.18.0"
"node": ">=16.17.0"
}
}

@@ -8,6 +8,6 @@ <picture>

[![Browsers](https://img.shields.io/badge/-Browsers-808080?logo=firefox&colorA=404040)](https://unpkg.com/modern-errors-bugs?module)
[![TypeScript](https://img.shields.io/badge/-Typed-808080?logo=typescript&colorA=404040&logoColor=0096ff)](/types/main.d.ts)
[![TypeScript](https://img.shields.io/badge/-Typed-808080?logo=typescript&colorA=404040&logoColor=0096ff)](/src/main.d.ts)
[![Codecov](https://img.shields.io/badge/-Tested%20100%25-808080?logo=codecov&colorA=404040)](https://codecov.io/gh/ehmicky/modern-errors-bugs)
[![Minified size](https://img.shields.io/bundlephobia/minzip/modern-errors-bugs?label&colorA=404040&colorB=808080&logo=webpack)](https://bundlephobia.com/package/modern-errors-bugs)
[![Twitter](https://img.shields.io/badge/-Twitter-808080.svg?logo=twitter&colorA=404040)](https://twitter.com/intent/follow?screen_name=ehmicky)
[![Mastodon](https://img.shields.io/badge/-Mastodon-808080.svg?logo=mastodon&colorA=404040&logoColor=9590F9)](https://fosstodon.org/@ehmicky)
[![Medium](https://img.shields.io/badge/-Medium-808080.svg?logo=medium&colorA=404040)](https://medium.com/@ehmicky)

@@ -28,2 +28,3 @@

import ModernError from 'modern-errors'
import modernErrorsBugs from 'modern-errors-bugs'

@@ -57,7 +58,10 @@

This package works in both Node.js >=14.18.0 and
[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/tasks/build/browserslist).
It is an ES module and must be loaded using
This package works in both Node.js >=16.17.0 and
[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/browserslist).
This is an ES module. It must be loaded using
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),
not `require()`.
not `require()`. If TypeScript is used, it must be configured to
[output ES modules](https://www.typescriptlang.org/docs/handbook/esm-node.html),
not CommonJS.

@@ -113,4 +117,4 @@ # API

- [`modern-errors`](https://github.com/ehmicky/modern-errors): Handle errors
like it's 2022 🔮
- [`modern-errors`](https://github.com/ehmicky/modern-errors): Handle errors in
a simple, stable, consistent way
- [`modern-errors-cli`](https://github.com/ehmicky/modern-errors-cli): Handle

@@ -128,2 +132,4 @@ errors in CLI modules

Log errors with Winston
- [`modern-errors-switch`](https://github.com/ehmicky/modern-errors-switch):
Execute class-specific logic

@@ -154,4 +160,4 @@ # Support

<!--
<table><tr><td align="center"><a href="https://twitter.com/ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4" width="100px;" alt="ehmicky"/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/ehmicky/modern-errors-bugs/commits?author=ehmicky" title="Code">💻</a> <a href="#design-ehmicky" title="Design">🎨</a> <a href="#ideas-ehmicky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ehmicky/modern-errors-bugs/commits?author=ehmicky" title="Documentation">📖</a></td></tr></table>
<table><tr><td align="center"><a href="https://fosstodon.org/@ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4" width="100px;" alt="ehmicky"/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/ehmicky/modern-errors-bugs/commits?author=ehmicky" title="Code">💻</a> <a href="#design-ehmicky" title="Design">🎨</a> <a href="#ideas-ehmicky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ehmicky/modern-errors-bugs/commits?author=ehmicky" title="Documentation">📖</a></td></tr></table>
-->
<!-- ALL-CONTRIBUTORS-LIST:END -->