LoginSignup
17
15

More than 5 years have passed since last update.

Node.js で __LINE__ を使うワンライナー

Posted at

LINE やっぱ欲しい時がある。
ということで、https://gist.github.com/mmalecki/3000364 を見つけたんだけど、
特に npm で入れる程でもないし、ワンライナーにまるめておいて必要なときにスニペット
から呼び出して貼れればいいやということで。

line.js
global.__defineGetter__('__LINE__', function () { return (new Error()).stack.split('\n')[2].split(':').reverse()[1]; });
log(__LINE__); // display current line number
17
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
15