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

dirkeeper

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dirkeeper - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

13

index.js

@@ -11,3 +11,3 @@ var async = require('async')

var pruneToCount = function(count, dirs, cb) {
// count >= dirs.length means prune nothing

@@ -18,7 +18,2 @@ if (count >= dirs.length) {

// count of 0 means prune everything
if (count === 0) {
count = dirs.length
}
// sort by mtime, oldest first

@@ -29,4 +24,6 @@ dirs = dirs.sort(function(a, b) {

// trim to *count* entries
dirs = dirs.slice(0, count)
// trim all but *count* newest entries
if (count !== 0) {
dirs = dirs.slice(0, -count)
}

@@ -33,0 +30,0 @@ // delete *count* oldest directories

{
"name": "dirkeeper",
"version": "0.2.0",
"version": "1.0.0",
"description": "Prune a directory to contain a set number of sub-directories, retention policy is recency",

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

@@ -127,8 +127,10 @@ var async = require('async')

fs.readdir(TEN_SUBDIRS, function(err, origFiles) {
keeper({ baseDir: TEN_SUBDIRS, count: 5 }, function(err) {
keeper({ baseDir: TEN_SUBDIRS, count: 3 }, function(err) {
fs.readdir(TEN_SUBDIRS, function(err, files) {
var dirs = filterDirs(TEN_SUBDIRS, files)
expect(dirs).to.have.length(5)
expect(dirs).to.have.length(3)
// the earliest dir names are the oldest. see makeDirs().
expect(dirs).to.not.contain(['tmpfile.0', 'tmpfile.1', 'tmpfile.2', 'tmpfile.3', 'tmpfile.4'])
expect(dirs).to.not.contain([
'tmpfile.0', 'tmpfile.1', 'tmpfile.2', 'tmpfile.3', 'tmpfile.4', 'tmpfile.5', 'tmpfile.6',
])
done()

@@ -135,0 +137,0 @@ })

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