New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

get-roots

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-roots - npm Package Compare versions

Comparing version 1.1.0 to 1.2.1

README.md

24

CHANGELOG.json

@@ -5,2 +5,26 @@ {

{
"version": "1.2.1",
"tag": "get-roots_v1.2.1",
"date": "Tue, 03 Sep 2019 12:08:52 GMT",
"comments": {
"patch": [
{
"comment": "added readme"
}
]
}
},
{
"version": "1.2.0",
"tag": "get-roots_v1.2.0",
"date": "Tue, 03 Sep 2019 12:04:26 GMT",
"comments": {
"minor": [
{
"comment": "changed the signature from sync to async"
}
]
}
},
{
"version": "1.1.0",

@@ -7,0 +31,0 @@ "tag": "get-roots_v1.1.0",

16

CHANGELOG.md
# Change Log - get-roots
This log was last generated on Wed, 28 Aug 2019 17:07:11 GMT and should not be manually modified.
This log was last generated on Tue, 03 Sep 2019 12:08:52 GMT and should not be manually modified.
## 1.2.1
Tue, 03 Sep 2019 12:08:52 GMT
### Patches
- added readme
## 1.2.0
Tue, 03 Sep 2019 12:04:26 GMT
### Minor changes
- changed the signature from sync to async
## 1.1.0

@@ -6,0 +20,0 @@ Wed, 28 Aug 2019 17:07:11 GMT

29

index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -14,15 +6,14 @@ const path_1 = require("path");

function getRootByFilename(location, filenames) {
return __awaiter(this, void 0, void 0, function* () {
let newLocation = location;
let currentLocation;
do {
currentLocation = newLocation;
const exists = yield Promise.all(filenames.map(filename => fs_extra_1.pathExists(path_1.resolve(currentLocation, filename))));
if (yield exists.some(doExist => doExist === true)) {
let newLocation = location;
let currentLocation;
do {
currentLocation = newLocation;
for (const filename of filenames) {
if (fs_extra_1.pathExistsSync(path_1.resolve(currentLocation, filename))) {
return currentLocation;
}
newLocation = path_1.dirname(currentLocation);
} while (currentLocation !== newLocation);
throw new Error('was not able to find root in ' + location);
});
}
newLocation = path_1.dirname(currentLocation);
} while (currentLocation !== newLocation);
throw new Error(`was not able to find root in ${location}`);
}

@@ -29,0 +20,0 @@ exports.getRootByFilename = getRootByFilename;

import {dirname, resolve} from "path";
import {pathExists} from "fs-extra";
import {pathExistsSync} from "fs-extra";
export async function getRootByFilename(location: string, filenames: string[]): Promise<string> {
export function getRootByFilename(location: string, filenames: string[]): string {
let newLocation = location;

@@ -9,9 +9,10 @@ let currentLocation: string;

currentLocation = newLocation;
const exists = await Promise.all(filenames.map(filename => pathExists(resolve(currentLocation, filename))));
if (await exists.some(doExist => doExist === true)) {
return currentLocation;
for (const filename of filenames) {
if (pathExistsSync(resolve(currentLocation, filename))) {
return currentLocation;
}
}
newLocation = dirname(currentLocation)
} while (currentLocation !== newLocation);
throw new Error('was not able to find root in ' + location)
throw new Error(`was not able to find root in ${location}`)
}

@@ -18,0 +19,0 @@

{
"name": "get-roots",
"version": "1.1.0",
"version": "1.2.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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