catch-match 1.0.1 → 1.0.5

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -0
  3. package/package.json +2 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Valeriy Kobzar
3
+ Copyright (c) 2022 Valeriy Kobzar
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # catch-match
2
+ ![image](https://user-images.githubusercontent.com/1615093/149611056-ad5f8c6c-d7fe-4a64-aed4-a1763135e7ee.png)
2
3
 
3
4
  ## Motivation
4
5
 
6
+ ### java
5
7
  ```java
6
8
  try {
7
9
  ...
@@ -16,6 +18,27 @@ try {
16
18
  }
17
19
  ```
18
20
 
21
+ ### javascript
22
+ ```javascript
23
+ try {
24
+ error; // error intruction
25
+ } catch (err) {
26
+ switch(err.constructor) {
27
+ case ReferenceError:
28
+ case SyntaxError:
29
+ console.error(`${err.constructor.name}: ${err.message}`);
30
+ break;
31
+ default:
32
+ console.error('other error:', err);
33
+ }
34
+ } finally {
35
+ console.log('final')
36
+ }
37
+
38
+ //> ReferenceError: error is not defined
39
+ //> final
40
+ ```
41
+
19
42
  ## Getting started
20
43
 
21
44
  ```shell
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "catch-match",
3
- "version": "1.0.1",
3
+ "version": "1.0.5",
4
4
  "repository": {
5
5
  "url": "https://github.com/kobzarvs/catch-match"
6
6
  },
7
+ "keywords": ["try", "catch", "match", "pattern", "errors", "exceptions", "throw", "finally"],
7
8
  "type": "module",
8
9
  "main": "dist/main.js",
9
10
  "scripts": {