error-message-utils 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/dist/message/message.utils.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ if (emailExists()) {
|
|
|
32
32
|
'The provided email is already in use.',
|
|
33
33
|
'EMAIL_EXISTS'
|
|
34
34
|
));
|
|
35
|
-
// The provided email is already in use.{(EMAIL_EXISTS)}
|
|
35
|
+
// 'The provided email is already in use.{(EMAIL_EXISTS)}'
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -43,7 +43,7 @@ import { decodeError } from 'error-message-utils';
|
|
|
43
43
|
decodeError('The provided email is already in use.{(EMAIL_EXISTS)}');
|
|
44
44
|
// {
|
|
45
45
|
// message: 'The provided email is already in use.',
|
|
46
|
-
// code: EMAIL_EXISTS
|
|
46
|
+
// code: 'EMAIL_EXISTS'
|
|
47
47
|
// }
|
|
48
48
|
```
|
|
49
49
|
|
|
@@ -142,5 +142,3 @@ Publish to `npm`:
|
|
|
142
142
|
```bash
|
|
143
143
|
$ npm publish
|
|
144
144
|
```
|
|
145
|
-
|
|
146
|
-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const CODE_WRAPPER={prefix:"{(",suffix:")}"},DEFAULT_MESSAGE="The error message could not be extracted, check the logs for more information.",DEFAULT_CODE=-1,wrapCode=e=>""+CODE_WRAPPER.prefix+(e??DEFAULT_CODE)+CODE_WRAPPER.suffix,__isEncodedError=e=>new RegExp(`${CODE_WRAPPER.prefix}.+${CODE_WRAPPER.suffix}$`).test(e),__isNumeric=e=>!Number.isNaN(Number.parseFloat(e)),unwrapCode=e=>{var r;return __isEncodedError(e)?(r=e.
|
|
1
|
+
const CODE_WRAPPER={prefix:"{(",suffix:")}"},DEFAULT_MESSAGE="The error message could not be extracted, check the logs for more information.",DEFAULT_CODE=-1,wrapCode=e=>""+CODE_WRAPPER.prefix+(e??DEFAULT_CODE)+CODE_WRAPPER.suffix,__isEncodedError=e=>new RegExp(`${CODE_WRAPPER.prefix}.+${CODE_WRAPPER.suffix}$`).test(e),__isNumeric=e=>!Number.isNaN(Number.parseFloat(e)),unwrapCode=e=>{var r;return __isEncodedError(e)?(r=e.lastIndexOf(CODE_WRAPPER.prefix),e=e.substring(r+2,e.lastIndexOf(CODE_WRAPPER.suffix)),{code:__isNumeric(e)?Number(e):e,startsAt:r}):{code:-1,startsAt:-1}};export{CODE_WRAPPER,DEFAULT_MESSAGE,DEFAULT_CODE,wrapCode,unwrapCode};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "error-message-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The error-message-utils package simplifies error management in your web applications and RESTful APIs. It ensures consistent and scalable handling of error messages, saving you time and effort. Moreover, it gives you the ability to assign custom error codes so all possible cases can be handled accordingly.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|