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

linguist-js

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linguist-js - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

13

dist/index.js

@@ -10,2 +10,3 @@ "use strict";

const glob_to_regexp_1 = __importDefault(require("glob-to-regexp"));
const node_cache_1 = __importDefault(require("node-cache"));
const convertToRegex = (path) => glob_to_regexp_1.default('**/' + path, { globstar: true, extended: true });

@@ -15,3 +16,13 @@ const last = (arr) => arr[arr.length - 1];

const dataUrl = (file) => `https://raw.githubusercontent.com/github/linguist/HEAD/lib/linguist/${file}`;
const loadFile = async (file) => await cross_fetch_1.default(dataUrl(file)).then(data => data.text());
const cache = new node_cache_1.default({});
async function loadFile(file) {
// Return cache if it exists
const cachedContent = cache.get(file);
if (cachedContent)
return cachedContent;
// Otherwise cache the request
const fileContent = await cross_fetch_1.default(dataUrl(file)).then(data => data.text());
cache.set(file, fileContent);
return fileContent;
}
function pcre(regex) {

@@ -18,0 +29,0 @@ let finalRegex = regex;

8

package.json
{
"name": "linguist-js",
"version": "1.5.1",
"version": "1.5.2",
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.",

@@ -11,3 +11,3 @@ "main": "dist/index.js",

"prepublish": "tsc",
"perf": "node test/perf",
"perf": "tsc && node test/perf",
"test": "tsc && node test/test"

@@ -40,2 +40,3 @@ },

"js-yaml": "^4.1.0",
"node-cache": "^5.1.2",
"tiny-glob": "^0.2.9"

@@ -48,3 +49,6 @@ },

"typescript": "~4.3.5"
},
"engines": {
"node": "^12 || ^14 || >=16"
}
}
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