stacktracey
Advanced tools
Comparing version 1.0.23 to 1.0.24
{ | ||
"name": "stacktracey", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"description": "Parses call stacks, reads sources and meta-information.", | ||
@@ -5,0 +5,0 @@ "main": "stacktracey", |
@@ -100,5 +100,5 @@ # StackTracey | ||
```javascript | ||
stack = stack.withSources.clean // it is better to call .clean on stacks supplied with sources, to make // @hide magic work | ||
``` | ||
stack = stack.clean | ||
``` | ||
@@ -111,3 +111,3 @@ 1. Merges repeated lines (via `.mergeRepeatedLines`) | ||
``` | ||
```javascript | ||
StackTracey.isThirdParty = path => path.includes ('jquery') | ||
@@ -118,3 +118,3 @@ ``` | ||
`StackTracey` instances expose `map`, `filter` and `slice` methods. These methods will return mapped, filtered and sliced `StackTracey` instances, respectively. All other methods of `Array` are supported too, but they will return `Array` instances, not `StackTracey` instances. You can convert arrays via this: | ||
All StackTracey instances expose `map`, `filter`, `concat` and `slice` methods. These methods will return mapped, filtered and sliced stacks, respectively. Any other method of the `Array` is supported too, it return `Array` instances, not StackTracey instances. You can convert from array via this: | ||
@@ -125,2 +125,8 @@ ```javascript | ||
And to array via this (but generally this is not needed, you can pass around StackTracey instances as if they were real Arrays): | ||
```javascript | ||
Array.from (stack) | ||
``` | ||
## Extra stuff | ||
@@ -127,0 +133,0 @@ |
@@ -66,2 +66,3 @@ "use strict"; | ||
return (shortPath[0] === '~') || // webpack-specific heuristic | ||
(shortPath[0] === '/') || // external source | ||
(shortPath.indexOf ('node_modules') === 0) || | ||
@@ -151,17 +152,15 @@ (shortPath.indexOf ('webpack/bootstrap') === 0) | ||
} | ||
} | ||
map (fn) { | ||
return new StackTracey (Array.prototype.map.call (this, fn)) | ||
} | ||
/* Array methods | ||
------------------------------------------------------------------------ */ | ||
filter (fn) { | ||
return new StackTracey (Array.prototype.filter.call (this, fn)) | ||
} | ||
;['map', 'filter', 'slice', 'concat'].forEach (name => { | ||
slice (begin, end) { | ||
return new StackTracey (Array.prototype.slice.call (this, begin, end)) | ||
StackTracey.prototype[name] = function (...args) { | ||
return new StackTracey (Array.prototype[name].apply (this, args)) | ||
} | ||
} | ||
}) | ||
/* A a private field that an Error instance can expose | ||
/* A private field that an Error instance can expose | ||
------------------------------------------------------------------------ */ | ||
@@ -168,0 +167,0 @@ |
@@ -82,3 +82,4 @@ "use strict"; | ||
clean.should.deep.equal ([ | ||
Array.from (clean).should.deep.equal ([ // .should does not recognize StackTracey as normal array... | ||
{ file: process.cwd () + '/yo.js', line: 11, callee: 'a.funkktion', calleeShort: 'a' }, | ||
@@ -85,0 +86,0 @@ { file: process.cwd () + '/yo.js', line: 10, callee: 'foobar.boobar → foobar.boobar', calleeShort: 'foobar → foobar' }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17423
135
220