@everymundo/linenumber
Advanced tools
Comparing version 1.0.1 to 1.0.2
19
index.js
@@ -1,13 +0,12 @@ | ||
function linenumber() { | ||
const | ||
err = new Error(''), | ||
{ stack } = err, | ||
firstI = stack.indexOf('\n', stack.indexOf('\n') + 1), | ||
secndI = (stack + '\n').indexOf('\n', firstI + 1), | ||
line = stack.substring(firstI, secndI), | ||
firstMatch = line.match(/\s+\(?((?:\/|\w:)([^:]+):\d+)/); | ||
function linenumber () { | ||
const err = new Error('') | ||
const { stack } = err | ||
const firstI = stack.indexOf('\n', stack.indexOf('\n') + 1) | ||
const secndI = (stack + '\n').indexOf('\n', firstI + 1) | ||
const line = stack.substring(firstI, secndI) | ||
const firstMatch = line.match(/\s+\(?((?:\/|\w:)([^:]+):\d+)/) | ||
return firstMatch[1].split(':').pop(); | ||
return firstMatch[1].split(':').pop() | ||
} | ||
module.exports = { linenumber }; | ||
module.exports = { linenumber } |
{ | ||
"name": "@everymundo/linenumber", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "This is a debugging and testing helper tool that returns the line number in which the function was invoked", | ||
"main": "index.js", | ||
"scripts": { | ||
"cover": "istanbul cover -x '*.test.js' _mocha", | ||
"cover": "LOG_LEVEL=trace nyc -x test --reporter=lcov --reporter=text mocha test --recursive", | ||
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100", | ||
"check-lint": "standard *.js lib/*.js test/*.js routes/*.js", | ||
"fix-lint": "standard --fix *.js lib/*.js test/*.js routes/*.js", | ||
"test": "mocha" | ||
}, | ||
"standard": { | ||
"env": [ | ||
"mocha" | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -19,4 +27,6 @@ "nodejs", | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"mocha": "^5.0.0" | ||
"chai": "^4.2.0", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.1.1", | ||
"standard": "^14.3.1" | ||
}, | ||
@@ -23,0 +33,0 @@ "directories": { |
@@ -1,11 +0,10 @@ | ||
const { expect } = require('chai'); | ||
const { expect } = require('chai') | ||
describe('server.js', () => { | ||
context('on load', () => { | ||
it('should export expected functions', () => { | ||
const {linenumber} = require('../'); | ||
const res = linenumber(); | ||
expect(res).to.equal('7'); | ||
}); | ||
}); | ||
}); | ||
describe('linenumber', () => { | ||
it('should export expected functions', () => { | ||
const { linenumber } = require('../') | ||
const res = linenumber() | ||
expect(res).to.equal('6') | ||
}) | ||
}) |
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
3263
4
18