@exodus/errors 1.0.0

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 ADDED
@@ -0,0 +1,13 @@
1
+ # @exodus/errors
2
+
3
+ ## Usage
4
+
5
+ ```javascript
6
+ import sanitizeErrorMessage from '@exodus/errors/sanitize'
7
+
8
+ try {
9
+ // the devil's work
10
+ } catch (e) {
11
+ console.error(sanitizeErrorMessage(e.message))
12
+ }
13
+ ```
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as sanitizeErrorMessage } from './sanitize.js';
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default as sanitizeErrorMessage } from './sanitize.js';
@@ -0,0 +1,2 @@
1
+ declare const sanitizeErrorMessage: (message: string) => string;
2
+ export default sanitizeErrorMessage;
@@ -0,0 +1,6 @@
1
+ const sanitizeErrorMessage = (message) => message
2
+ .replaceAll(/(?:[A-Za-z]{3,20}\s+){11}[A-Za-z]{3,20}/g, '****')
3
+ .replaceAll(/(?:0x)?[\dA-Fa-f]{20,}/g, '****')
4
+ .replaceAll(/[1-9A-HJ-NP-Za-km-z]{50,}/g, '****')
5
+ .replaceAll(/(?:[\d+/A-Za-z]{4}){3,}(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=|[\d+/A-Za-z]{4})/g, '****');
6
+ export default sanitizeErrorMessage;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@exodus/errors",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "Utilities for error handling in client code, such as sanitization",
6
+ "author": "Exodus Movement, Inc.",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
10
+ },
11
+ "homepage": "https://github.com/ExodusMovement/exodus-hydra/tree/master/libraries/errors",
12
+ "license": "UNLICENSED",
13
+ "bugs": {
14
+ "url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Aerrors"
15
+ },
16
+ "main": "lib/index.js",
17
+ "exports": {
18
+ ".": "./lib/index.js",
19
+ "./sanitize": "./lib/sanitize.js"
20
+ },
21
+ "files": [
22
+ "lib",
23
+ "README.md",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "scripts": {
27
+ "build": "run -T tsc --build tsconfig.build.json",
28
+ "prepublishOnly": "yarn run -T build --scope @exodus/errors",
29
+ "clean": "run -T tsc --build --clean",
30
+ "lint": "run -T eslint . --ignore-path ../../.gitignore",
31
+ "lint:fix": "yarn lint --fix",
32
+ "test": "run -T exodus-test --esbuild"
33
+ },
34
+ "devDependencies": {
35
+ "@exodus/errors-fixture": "^1.0.0"
36
+ },
37
+ "gitHead": "c56db0c4232e4d7b20d2848ee661b1530774fce8"
38
+ }