loaded-language-linter
Advanced tools
Comparing version
@@ -1,15 +0,7 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _fs = require('fs'); | ||
var _fs = require("fs"); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _textract = require('textract'); | ||
var _textract2 = _interopRequireDefault(_textract); | ||
var _validUrl = require('valid-url'); | ||
var _validUrl2 = _interopRequireDefault(_validUrl); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -21,18 +13,6 @@ | ||
var text = void 0; | ||
var text = input; | ||
var lowerCaseText = input.toLowerCase(); | ||
var matches = []; | ||
if (_validUrl2.default.isUri(input)) { | ||
_textract2.default.fromUrl(input, { preserveLineBreaks: true }, function (error, res) { | ||
if (error) { | ||
console.log(error); | ||
} | ||
text = res; | ||
}); | ||
} else { | ||
text = input; | ||
} | ||
var lcText = text.toLowerCase(); | ||
var _iteratorNormalCompletion = true; | ||
@@ -46,3 +26,3 @@ var _didIteratorError = false; | ||
if (lcText.indexOf(term) > -1) { | ||
if (lowerCaseText.indexOf(term) > -1) { | ||
matches.push(term); | ||
@@ -49,0 +29,0 @@ } |
{ | ||
"name": "loaded-language-linter", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A small Node.JS library to detect loaded language.", | ||
@@ -28,6 +28,3 @@ "main": "./dist/index.js", | ||
}, | ||
"dependencies": { | ||
"textract": "^2.1.1", | ||
"valid-url": "^1.0.9" | ||
} | ||
"dependencies": {} | ||
} |
@@ -1,4 +0,2 @@ | ||
import fs from 'fs'; | ||
import textract from 'textract'; | ||
import validUrl from 'valid-url'; | ||
import fs from 'fs' | ||
@@ -9,18 +7,8 @@ module.exports = function (input) { | ||
let text; | ||
let text = input; | ||
let lowerCaseText = input.toLowerCase(); | ||
let matches = []; | ||
if (validUrl.isUri(input)) { | ||
textract.fromUrl(input, {preserveLineBreaks: true}, function (error, res) { | ||
if (error) { console.log(error) } | ||
text = res; | ||
}) | ||
} else { | ||
text = input; | ||
} | ||
let lcText = text.toLowerCase(); | ||
for (const term of terms) { | ||
if (lcText.indexOf(term) > -1) { | ||
if (lowerCaseText.indexOf(term) > -1) { | ||
matches.push(term); | ||
@@ -27,0 +15,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
-100%74976
-39.36%9
-10%335
-6.69%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed