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

locter

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

locter - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

dist/locator/async.d.ts
import { LocatorInfo, LocatorOptions } from './type';
export declare function locateFiles(pattern: string, options?: Partial<LocatorOptions>): Promise<LocatorInfo[]>;
export declare function locateFile(pattern: string, options?: Partial<LocatorOptions>): Promise<LocatorInfo | undefined>;
export declare function locateFiles(pattern: string | string[], options?: Partial<LocatorOptions>): Promise<LocatorInfo[]>;
export declare function locateFile(pattern: string | string[], options?: Partial<LocatorOptions>): Promise<LocatorInfo | undefined>;

@@ -30,16 +30,21 @@ "use strict";

options = (0, utils_1.buildLocatorOptions)(options);
const patterns = Array.isArray(pattern) ?
pattern :
[pattern];
const items = [];
for (let i = 0; i < options.paths.length; i++) {
const files = yield globAsync(pattern, {
absolute: true,
cwd: options.paths[i],
nodir: true,
});
for (let j = 0; j < files.length; j++) {
const fileInfo = path_1.default.parse(files[j]);
items.push({
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
for (let i = 0; i < patterns.length; i++) {
for (let j = 0; j < options.path.length; j++) {
const files = yield globAsync(patterns[i], {
absolute: true,
cwd: options.path[j],
nodir: true,
});
for (let k = 0; k < files.length; k++) {
const fileInfo = path_1.default.parse(files[k]);
items.push({
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
});
}
}

@@ -54,16 +59,21 @@ }

options = (0, utils_1.buildLocatorOptions)(options);
for (let i = 0; i < options.paths.length; i++) {
const files = yield globAsync(pattern, {
absolute: true,
cwd: options.paths[i],
nodir: true,
});
const element = files.shift();
if (element) {
const fileInfo = path_1.default.parse(element);
return {
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
};
const patterns = Array.isArray(pattern) ?
pattern :
[pattern];
for (let i = 0; i < patterns.length; i++) {
for (let j = 0; j < options.path.length; j++) {
const files = yield globAsync(patterns[i], {
absolute: true,
cwd: options.path[j],
nodir: true,
});
const element = files.shift();
if (element) {
const fileInfo = path_1.default.parse(element);
return {
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
};
}
}

@@ -70,0 +80,0 @@ }

import { LocatorInfo, LocatorOptions } from './type';
export declare function locateFilesSync(pattern: string, options?: Partial<LocatorOptions>): LocatorInfo[];
export declare function locateFileSync(pattern: string, options?: Partial<LocatorOptions>): LocatorInfo | undefined;
export declare function locateFilesSync(pattern: string | string[], options?: Partial<LocatorOptions>): LocatorInfo[];
export declare function locateFileSync(pattern: string | string[], options?: Partial<LocatorOptions>): LocatorInfo | undefined;

@@ -18,16 +18,21 @@ "use strict";

options = (0, utils_1.buildLocatorOptions)(options);
const patterns = Array.isArray(pattern) ?
pattern :
[pattern];
const items = [];
for (let i = 0; i < options.paths.length; i++) {
const files = (0, glob_1.sync)(pattern, {
absolute: true,
cwd: options.paths[i],
nodir: true,
});
for (let j = 0; j < files.length; j++) {
const fileInfo = path_1.default.parse(files[j]);
items.push({
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
for (let i = 0; i < patterns.length; i++) {
for (let j = 0; j < options.path.length; j++) {
const files = (0, glob_1.sync)(patterns[i], {
absolute: true,
cwd: options.path[j],
nodir: true,
});
for (let k = 0; k < files.length; k++) {
const fileInfo = path_1.default.parse(files[k]);
items.push({
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
});
}
}

@@ -40,16 +45,21 @@ }

options = (0, utils_1.buildLocatorOptions)(options);
for (let i = 0; i < options.paths.length; i++) {
const files = (0, glob_1.sync)(pattern, {
absolute: true,
cwd: options.paths[i],
nodir: true,
});
const element = files.shift();
if (element) {
const fileInfo = path_1.default.parse(element);
return {
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
};
const patterns = Array.isArray(pattern) ?
pattern :
[pattern];
for (let i = 0; i < patterns.length; i++) {
for (let j = 0; j < options.path.length; j++) {
const files = (0, glob_1.sync)(patterns[i], {
absolute: true,
cwd: options.path[j],
nodir: true,
});
const element = files.shift();
if (element) {
const fileInfo = path_1.default.parse(element);
return {
path: fileInfo.dir.split('/').join(path_1.default.sep),
fileName: fileInfo.name,
fileExtension: fileInfo.ext,
};
}
}

@@ -56,0 +66,0 @@ }

@@ -7,3 +7,3 @@ export declare type LocatorInfo = {

export declare type LocatorOptions = {
paths: string | string[];
path: string | string[];
};

@@ -13,6 +13,6 @@ "use strict";

options = options || {};
options.paths = options.paths || [];
options.paths = (0, utils_1.toArray)(options.paths);
if (options.paths.length === 0) {
options.paths.push(process.cwd());
options.path = options.path || [];
options.path = (0, utils_1.toArray)(options.path);
if (options.path.length === 0) {
options.path.push(process.cwd());
}

@@ -19,0 +19,0 @@ return options;

{
"name": "locter",
"version": "0.1.1",
"version": "0.1.2",
"description": "Locter is a library to locate a file by criteria and load it",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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