Skip to content

Commit 309dbb8

Browse files
committed
Cleanup examples and avoid confusing use of fat arrows
1 parent 4a7431d commit 309dbb8

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

MIGRATION_GUIDE.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ All you have to do to get stacktrace.js v0.x behavior is call `.toString()` on a
1616
v0.x:
1717
```js
1818
printStackTrace();
19-
=> Array[String]
19+
//===> Array[String]
2020
```
2121

2222
v1.x:
2323
```js
2424
StackTrace.get().then(callback).catch(errback);
25-
=> Promise(Array[StackFrame], Error)
25+
//===> Promise(Array[StackFrame], Error)
2626
```
2727

2828
`StackTrace.get()` returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
@@ -34,14 +34,14 @@ v0.x:
3434
```js
3535
var error = new Error('Boom');
3636
printStackTrace({e: error});
37-
=> Array[String]
37+
//===> Array[String]
3838
```
3939

4040
v1.x:
4141
```js
4242
var error = new Error('Boom');
4343
StackTrace.fromError(error).then(callback).catch(errback);
44-
=> Promise(Array[StackFrame], Error)
44+
//===> Promise(Array[StackFrame], Error)
4545
```
4646

4747
If this is all you need, you don't even need the full stacktrace.js library! Just use [error-stack-parser](https://github.com/stacktracejs/error-stack-parser)!
@@ -55,23 +55,23 @@ Instrumenting now takes `Function` references instead of `String`s.
5555

5656
v0.x:
5757
```js
58-
function interestingFn() {...};
58+
function interestingFn() {/* ... */}
5959

6060
var p = new printStackTrace.implementation();
6161
p.instrumentFunction(this, 'interestingFn', logStackTrace);
62-
=> Function (instrumented)
62+
//===> Function (instrumented)
6363

6464
p.deinstrumentFunction(this, 'interestingFn');
65-
=> Function (original)
65+
//===> Function (original)
6666
```
6767

6868
v1.x:
6969
```js
70-
function interestingFn() {...};
70+
function interestingFn() {/* ... */}
7171

7272
StackTrace.instrument(interestingFn, callback, errback);
73-
=> Function (instrumented)
73+
//===> Function (instrumented)
7474

7575
StackTrace.deinstrument(interestingFn);
76-
=> Function (original)
76+
//===> Function (original)
7777
```

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ var callback = function(stackframes) {
2424

2525
var errback = function(err) { console.log(err.message); };
2626

27-
StackTrace.get().then(callback).catch(errback)
28-
=> Promise(Array[StackFrame], Error)
29-
=> callback([StackFrame('func1', [], 'file.js', 203, 9), StackFrame('func2', [], 'http://localhost:3000/file.min.js', 1, 3284)])
27+
StackTrace.get().then(callback).catch(errback);
28+
//===> Promise(Array[StackFrame], Error)
29+
//===> callback([StackFrame('func1', [], 'file.js', 203, 9), StackFrame('func2', [], 'http://localhost:3000/file.min.js', 1, 3284)])
3030
```
3131

3232
#### window.onerror integration
@@ -42,29 +42,29 @@ window.onerror = function(msg, file, line, col, error) {
4242
```js
4343
var error = new Error('BOOM!');
4444

45-
StackTrace.fromError(error).then(callback).catch(errback)
46-
=> Promise(Array[StackFrame], Error)
45+
StackTrace.fromError(error).then(callback).catch(errback);
46+
//===> Promise(Array[StackFrame], Error)
4747
```
4848

4949
#### Generate a stacktrace from walking arguments.callee
5050
This might capture arguments information, but isn't supported in ES5 strict-mode
5151
```js
52-
StackTrace.generateArtificially().then(callback).catch(errback)
53-
=> Promise(Array[StackFrame], Error)
52+
StackTrace.generateArtificially().then(callback).catch(errback);
53+
//===> Promise(Array[StackFrame], Error)
5454
```
5555

5656
#### Trace every time a given function is invoked
5757
```js
5858
// callback is called with an Array[StackFrame] every time wrapped function is called
59-
var myFunc = function(arg) { return 'Hello ' + arg; }
60-
var myWrappedFunc = StackTrace.instrument(myFunc, callback, errback)
61-
=> Instrumented Function
59+
var myFunc = function(arg) { return 'Hello ' + arg; };
60+
var myWrappedFunc = StackTrace.instrument(myFunc, callback, errback);
61+
//===> Instrumented Function
6262
myWrappedFunc('world');
63-
=> 'Hello world'
63+
//===> 'Hello world'
6464

6565
// Use this if you overwrote you original function
66-
myFunc = StackTrace.deinstrument(myFunc)
67-
=> De-instrumented Function
66+
myFunc = StackTrace.deinstrument(myFunc);
67+
//===> De-instrumented Function
6868
```
6969

7070
## Get stacktrace.js

0 commit comments

Comments
 (0)