You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/JS-DevTools/ono/blob/master/.github/workflows/CI-CD.yaml)
13
13
@@ -33,7 +33,7 @@ Example
33
33
--------------------------
34
34
35
35
```javascript
36
-
constono=require("ono");
36
+
constono=require("@jsdevtools/ono");
37
37
38
38
// Throw an error with custom properties
39
39
throwono({ code:"NOT_FOUND", status:404 }, `Resource not found: ${url}`);
// Create an Ono method for your own custom error class
57
-
const { Ono } =require("ono");
57
+
const { Ono } =require("@jsdevtools/ono");
58
58
classMyErrorClassextendsError {}
59
59
ono.myError=newOno(MyErrorClass);
60
60
@@ -79,13 +79,13 @@ Usage
79
79
When using Ono in Node.js apps, you'll probably want to use **CommonJS** syntax:
80
80
81
81
```javascript
82
-
constono=require("ono");
82
+
constono=require("@jsdevtools/ono");
83
83
```
84
84
85
85
When using a transpiler such as [Babel](https://babeljs.io/) or [TypeScript](https://www.typescriptlang.org/), or a bundler such as [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/), you can use **ECMAScript modules** syntax instead:
86
86
87
87
```javascript
88
-
importonofrom"ono";
88
+
importonofrom"@jsdevtools/ono";
89
89
```
90
90
91
91
@@ -152,7 +152,7 @@ The `Ono` constructor takes an optional options object as a second parameter. Th
152
152
When wrapping an error, Ono's default behavior is to append the error's message to your message, with a newline between them. For example:
153
153
154
154
```javascript
155
-
constono=require("ono");
155
+
constono=require("@jsdevtools/ono");
156
156
157
157
functioncreateArray(length) {
158
158
try {
@@ -178,7 +178,7 @@ Invalid array length;
178
178
If you'd rather not include the original message, then you can set the `concatMessages` option to `false`. For example:
179
179
180
180
```javascript
181
-
const { ono, Ono } =require("ono");
181
+
const { ono, Ono } =require("@jsdevtools/ono");
182
182
183
183
// Override the default behavior for the RangeError
@@ -248,7 +248,7 @@ Here are some compatible polyfill libraries:
248
248
If the standard [`util.format()`](https://nodejs.org/api/util.html#util_util_format_format_args) functionality isn't sufficient for your needs, then you can set the `format` option to your own custom implementation. Here's a simplistic example:
249
249
250
250
```javascript
251
-
const { ono, Ono } =require("ono");
251
+
const { ono, Ono } =require("@jsdevtools/ono");
252
252
253
253
// This is a simple formatter that replaces $0, $1, $2, ... with the corresponding argument
254
254
let options = {
@@ -281,7 +281,7 @@ Custom Error Classes
281
281
Ono has built-in support for all of [the built-in JavaScript Error types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types). For example, you can use `ono.reference()` to create a `ReferenceError`, or `ono.syntax()` to create a `SyntaxError`. In addition to the built-in types, you can also create Ono methods for your own custom error classes.
282
282
283
283
```javascript
284
-
const { ono, Ono } =require("ono");
284
+
const { ono, Ono } =require("@jsdevtools/ono");
285
285
let counter =0;
286
286
287
287
// A custom Error class that assigns a unique ID and timestamp to each error
0 commit comments