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

dat-ignore

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-ignore - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

11

index.js

@@ -17,3 +17,3 @@ var fs = require('fs')

var allow = ['**/.well-known/dat'] // whitelist
var allow = ['!**/.well-known/dat']
var ignoreMatches = opts.ignore // we end up with array of ignores here

@@ -25,3 +25,3 @@ ? Array.isArray(opts.ignore)

var defaultIgnore = [/^(?:\/.*)?\.dat(?:\/.*)?$/, '.DS_Store'] // ignore .dat (and DS_Store)
var defaultIgnore = [/^(?:\/.*)?\.dat(?:\/.*)?$/, '.DS_Store', '**/.DS_Store'] // ignore .dat (and DS_Store)
var ignoreHidden = !(opts.ignoreHidden === false) ? [/(^\.|\/\.).*/] : null // ignore hidden files anywhere

@@ -34,5 +34,7 @@ var datIgnore = !(opts.useDatIgnore === false) ? readDatIgnore() : null

if (ignoreHidden) ignoreMatches = ignoreMatches.concat(ignoreHidden) // ignore all hidden things
ignoreMatches = ignoreMatches.concat(allow)
return function (file) {
if (match(allow, file)) return false
if (dir) file = file.replace(dir, '') // remove dir so we do not ignore that
file = file.replace(/^\//, '')
return match(ignoreMatches, file)

@@ -51,5 +53,2 @@ }

})
.map(function (line) {
return path.join(dir, line) // prepend the dir to each line
})
} catch (e) {

@@ -56,0 +55,0 @@ return []

{
"name": "dat-ignore",
"description": "default ignore for dat",
"version": "1.1.0",
"version": "1.1.1",
"author": "Joe Hand <joe@hand.email>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -12,3 +12,2 @@ var fs = require('fs')

// Dat Ignore stuff
t.notOk(ignore('index.js'), 'index.js without path not ignored by .datignore')
t.ok(ignore(path.join(__dirname, 'index.js')), 'full path index.js is ignored by .datignore')

@@ -19,2 +18,11 @@

test('ignore from within hidden folder', function (t) {
var dir = path.join(__dirname, '.hidden')
var ignore = datIgnore(dir)
checkDefaults(t, ignore)
t.notOk(ignore(path.join(dir, 'index.js')), 'file allowed inside hidden')
t.end()
})
test('custom ignore extends default (string)', function (t) {

@@ -56,4 +64,2 @@ var ignore = datIgnore(__dirname, {ignore: '**/*.js'})

t.ok(ignore('.dat'), '.dat ignored')
t.notOk(ignore('index.js'), 'wrong full path in datignore not ignored')
t.notOk(ignore(path.join(__dirname, 'index.js')), 'wrong full path in datignore not ignored')
t.ok(ignore(path.join(__dirname, '..', 'index.js')), 'file in datignore ignored')

@@ -66,3 +72,2 @@ t.end()

t.ok(ignore('.dat'), '.dat ignored')
t.notOk(ignore('index.js'), 'wrong full path in datignore not ignored')
t.ok(ignore(path.join(__dirname, 'index.js')), 'file in datignore ignored')

@@ -75,3 +80,2 @@ t.end()

t.ok(ignore('.dat'), '.dat ignored')
t.notOk(ignore('index.js'), 'wrong full path in datignore not ignored')
t.ok(ignore(path.join(__dirname, 'index.js')), 'file in datignore ignored')

@@ -90,3 +94,2 @@ t.end()

checkDefaults(t, ignore)
t.notOk(ignore('/.well-known/dat'), 'well known dat not ignored')
t.notOk(ignore(path.join(__dirname, '.well-known/dat')), 'well known dat not ignored')

@@ -93,0 +96,0 @@ t.end()

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