Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stack-sites

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stack-sites - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

src/parse-stack-line.js

2

package.json
{
"name": "stack-sites",
"description": "Returns current stack as call sites",
"version": "1.1.0",
"version": "1.2.0",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/bahmutov/stack-sites/issues",

'use strict'
const la = require('lazy-ass')
const is = require('check-more-types')
const parseStackLine = require('./parse-stack-line')
function isNotEmpty (s) {
return s
}
// s is like (/src/index.js:4:13)
function parseAt (s) {
const parts = s.replace(/\(/, '')
.replace(/\)/, '')
.trim()
.split(':')
la(parts.length === 3, 'invalid number of parts', s)
return {
filename: parts[0],
line: parts[1],
column: parts[2]
}
}
function toSite (line) {
la(is.unemptyString(line), 'invalid line', line)
const parts = line.split(' ').filter(isNotEmpty)
const at = parseAt(parts[2])
return {
functionName: parts[1],
filename: at.filename,
line: Number(at.line),
column: Number(at.column)
}
}
function hasLineInfo (line) {

@@ -50,5 +19,5 @@ return line.includes('(') && line.includes(')')

.filter(isModule)
.map(toSite)
.map(parseStackLine)
}
module.exports = stackSites
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc