Created
October 30, 2018 04:00
-
-
Save deptno/dd5de59a454602a770b2bd5c5199c4a5 to your computer and use it in GitHub Desktop.
extract line number sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stack = new Error().stack!.split('\n').slice(3)[0] | |
const regexp = /\((\S+)\)/ | |
const match = stack.match(regexp)![1] | |
const line = `${path.basename(path.dirname(match))}/${path.basename(match)}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment