Comparing version 2.2.1 to 2.2.7
25
index.js
@@ -14,9 +14,24 @@ 'use strict'; | ||
var exists = node_fs.existsSync ? | ||
function (file) { | ||
return node_fs.existsSync(file); | ||
} : | ||
// if node <= 0.6, there's no fs.existsSync method. | ||
function (file) { | ||
try { | ||
node_fs.statSync(file); | ||
return true; | ||
} catch(e) { | ||
return false; | ||
} | ||
}; | ||
// Select the first existing file of the file list | ||
ignore.select = function (files) { | ||
var exists; | ||
var selected; | ||
files.some(function (file) { | ||
if( node_fs.existsSync(file) ){ | ||
exists = file; | ||
if( exists(file) ){ | ||
selected = file; | ||
return true; | ||
@@ -26,3 +41,3 @@ } | ||
return exists; | ||
return selected; | ||
}; | ||
@@ -33,3 +48,3 @@ | ||
// - ignore: {Array} | ||
// - twoGlobstars: {boolean=false} enable pattern '`**`' (two consecutive asterisks), default to `false`. | ||
// - twoGlobstars: {boolean=false} enable pattern `'**'` (two consecutive asterisks), default to `false`. | ||
// If false, ignore patterns with two globstars will be omitted | ||
@@ -36,0 +51,0 @@ // - matchCase: {boolean=true} case sensitive. |
{ | ||
"name": "ignore", | ||
"version": "2.2.1", | ||
"version": "2.2.7", | ||
"description": "Ignore is a manager and filter for .gitignore rules.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,2 +1,4 @@ | ||
[![NPM version](https://badge.fury.io/js/ignore.png)](http://badge.fury.io/js/ignore) | ||
[![Build Status](https://travis-ci.org/kaelzhang/node-ignore.png?branch=master)](https://travis-ci.org/kaelzhang/node-ignore) | ||
[![Dependency Status](https://gemnasium.com/kaelzhang/node-ignore.png)](https://gemnasium.com/kaelzhang/node-ignore) | ||
@@ -3,0 +5,0 @@ # ignore |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21986
463
140