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

findup-sync

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

findup-sync - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

28

index.js

@@ -11,2 +11,3 @@ 'use strict';

var resolveDir = require('resolve-dir');
var exists = require('fs-exists-sync');
var mm = require('micromatch');

@@ -30,5 +31,7 @@

var len = patterns.length, i = -1;
while (++i < len) {
var res = lookup(patterns[i], options);
var len = patterns.length;
var idx = -1;
while (++idx < len) {
var res = lookup(patterns[idx], options);
if (res) {

@@ -44,3 +47,3 @@ return res;

options = options || {};
var cwd = resolveDir(options.cwd || '');
var cwd = path.resolve(resolveDir(options.cwd || ''));
if (isGlob(pattern)) {

@@ -56,6 +59,7 @@ return matchFile(cwd, pattern, options);

var files = fs.readdirSync(cwd);
var len = files.length, i = -1;
var len = files.length;
var idx = -1;
while (++i < len) {
var name = files[i];
while (++idx < len) {
var name = files[idx];
var fp = path.join(cwd, name);

@@ -75,4 +79,4 @@ if (isMatch(name) || isMatch(fp)) {

function findFile(cwd, filename) {
var fp = cwd ? (cwd + '/' + filename) : filename;
if (fs.existsSync(fp)) {
var fp = cwd ? path.resolve(cwd, filename) : filename;
if (exists(fp)) {
return fp;

@@ -85,5 +89,5 @@ }

while (len--) {
cwd = segs.slice(0, len).join('/');
fp = cwd + '/' + filename;
if (fs.existsSync(fp)) {
cwd = segs.slice(0, len).join(path.sep);
fp = path.resolve(cwd, filename);
if (exists(fp)) {
return fp;

@@ -90,0 +94,0 @@ }

{
"name": "findup-sync",
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/cowboy/node-findup-sync",

@@ -23,2 +23,3 @@ "author": "\"Cowboy\" Ben Alman (http://benalman.com)",

"dependencies": {
"fs-exists-sync": "^0.1.0",
"is-glob": "^2.0.1",

@@ -29,3 +30,3 @@ "micromatch": "^2.3.7",

"devDependencies": {
"grunt": "^0.4.5",
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^0.12.0",

@@ -36,4 +37,4 @@ "is-absolute": "^0.2.3",

"normalize-path": "^2.0.1",
"resolve": "^1.1.7",
"user-home": "^2.0.0"
"os-homedir": "^1.0.1",
"resolve": "^1.1.7"
},

@@ -40,0 +41,0 @@ "keywords": [

@@ -1,2 +0,2 @@

# findup-sync [![Build Status](https://travis-ci.org/cowboy/node-findup-sync.svg)](https://travis-ci.org/cowboy/node-findup-sync) [![NPM version](https://badge.fury.io/js/findup-sync.svg)](http://badge.fury.io/js/findup-sync)
# findup-sync [![Build Status](https://travis-ci.org/js-cli/node-findup-sync.svg)](https://travis-ci.org/js-cli/node-findup-sync) [![NPM version](https://badge.fury.io/js/findup-sync.svg)](http://badge.fury.io/js/findup-sync)

@@ -3,0 +3,0 @@ > Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

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