goldstein 1.3.0 → 1.4.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/ChangeLog +6 -0
- package/README.md +4 -4
- package/package.json +1 -1
- package/packages/keyword-safe/index.js +6 -0
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -122,27 +122,27 @@ function hello() {
|
|
|
122
122
|
Applies [`tryCatch`](https://github.com/coderaiser/try-catch):
|
|
123
123
|
|
|
124
124
|
```gs
|
|
125
|
-
safe hello(1, 2, 3);
|
|
125
|
+
const [error, result] = safe hello(1, 2, 3);
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
Is the same as:
|
|
129
129
|
|
|
130
130
|
```js
|
|
131
131
|
import tryCatch from 'try-catch';
|
|
132
|
-
tryCatch(1, 2, 3);
|
|
132
|
+
const [error, result] = tryCatch(1, 2, 3);
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
and
|
|
136
136
|
|
|
137
137
|
```gs
|
|
138
|
-
safe await hello(1, 2, 3);
|
|
138
|
+
const [error, result] = safe await hello(1, 2, 3);
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
Is the same as:
|
|
142
142
|
|
|
143
143
|
```js
|
|
144
144
|
import tryToCatch from 'try-catch';
|
|
145
|
-
await tryToCatch(1, 2, 3);
|
|
145
|
+
const [error, result] = await tryToCatch(1, 2, 3);
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
## How to contribute?
|
package/package.json
CHANGED
|
@@ -31,6 +31,12 @@ export default function newSpeak(Parser) {
|
|
|
31
31
|
|
|
32
32
|
return super.parseStatement(context, topLevel, exports);
|
|
33
33
|
}
|
|
34
|
+
parseExprAtom(refDestructuringErrors, forInit) {
|
|
35
|
+
if (this.type === keywordTypes.safe)
|
|
36
|
+
return this.parseSafe();
|
|
37
|
+
|
|
38
|
+
return super.parseExprAtom(refDestructuringErrors, forInit);
|
|
39
|
+
}
|
|
34
40
|
|
|
35
41
|
parseSafe() {
|
|
36
42
|
this.next();
|